1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #2818 from yurydelendik/seac

Seac support for Windows
This commit is contained in:
Brendan Dahl 2013-03-05 09:02:54 -08:00
commit 0e14f0ccae
6 changed files with 207 additions and 15 deletions

View file

@ -29,6 +29,7 @@
!issue1905.pdf
!issue1249.pdf
!smaskdim.pdf
!endchar.pdf
!type4psfunc.pdf
!issue1350.pdf
!S2.pdf

BIN
test/pdfs/endchar.pdf Normal file

Binary file not shown.

View file

@ -461,6 +461,12 @@
"rounds": 1,
"type": "eq"
},
{ "id": "endchar",
"file": "pdfs/endchar.pdf",
"md5": "90a59acdd62252fdb4fefa482e12d6b3",
"rounds": 1,
"type": "eq"
},
{ "id": "type4psfunc",
"file": "pdfs/type4psfunc.pdf",
"md5": "7e6027a02ff78577f74dccdf84e37189",

View file

@ -1,6 +1,7 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals expect, it, describe, CFFCompiler, CFFParser, CFFIndex, CFFStrings */
/* globals expect, it, describe, CFFCompiler, CFFParser, CFFIndex, CFFStrings,
SEAC_ANALYSIS_ENABLED:true */
'use strict';
@ -113,12 +114,65 @@ describe('font', function() {
14 // endchar
]);
parser.bytes = bytes;
var charStrings = parser.parseCharStrings(0);
var charStrings = parser.parseCharStrings(0).charStrings;
expect(charStrings.count).toEqual(1);
// shoudn't be sanitized
expect(charStrings.get(0).length).toEqual(38);
});
it('parses a CharString endchar with 4 args w/seac enabled', function() {
var seacAnalysisState = SEAC_ANALYSIS_ENABLED;
try {
SEAC_ANALYSIS_ENABLED = true;
var bytes = new Uint8Array([0, 1, // count
1, // offsetSize
0, // offset[0]
237, 247, 22, 247, 72, 204, 247, 86, 14]);
parser.bytes = bytes;
var result = parser.parseCharStrings(0);
expect(result.charStrings.count).toEqual(1);
expect(result.charStrings.get(0).length).toEqual(1);
expect(result.seacs.length).toEqual(1);
expect(result.seacs[0].length).toEqual(4);
expect(result.seacs[0][0]).toEqual(130);
expect(result.seacs[0][1]).toEqual(180);
expect(result.seacs[0][2]).toEqual(65);
expect(result.seacs[0][3]).toEqual(194);
} finally {
SEAC_ANALYSIS_ENABLED = seacAnalysisState;
}
});
it('parses a CharString endchar with 4 args w/seac disabled', function() {
var seacAnalysisState = SEAC_ANALYSIS_ENABLED;
try {
SEAC_ANALYSIS_ENABLED = false;
var bytes = new Uint8Array([0, 1, // count
1, // offsetSize
0, // offset[0]
237, 247, 22, 247, 72, 204, 247, 86, 14]);
parser.bytes = bytes;
var result = parser.parseCharStrings(0);
expect(result.charStrings.count).toEqual(1);
expect(result.charStrings.get(0).length).toEqual(9);
expect(result.seacs.length).toEqual(0);
} finally {
SEAC_ANALYSIS_ENABLED = seacAnalysisState;
}
});
it('parses a CharString endchar no args', function() {
var bytes = new Uint8Array([0, 1, // count
1, // offsetSize
0, // offset[0]
14]);
parser.bytes = bytes;
var result = parser.parseCharStrings(0);
expect(result.charStrings.count).toEqual(1);
expect(result.charStrings.get(0)[0]).toEqual(14);
expect(result.seacs.length).toEqual(0);
});
it('parses predefined charsets', function() {
var charset = parser.parseCharsets(0, 0, null, true);
expect(charset.predefined).toEqual(true);