Browse Source

Merge pull request #1418 from notmasteryet/truetype-enc-2

Checking if it's a true symbolic truetype font
Brendan Dahl 13 years ago
parent
commit
d9bb76d54c
  1. 13
      src/fonts.js
  2. 1
      test/pdfs/preistabelle.pdf.link
  3. 8
      test/test_manifest.json

13
src/fonts.js

@ -1958,6 +1958,19 @@ var Font = (function FontClosure() { @@ -1958,6 +1958,19 @@ var Font = (function FontClosure() {
glyphsRemoved++;
}
// checking if it's a "true" symbolic font
if (this.isSymbolicFont) {
var minUnicode = 0xFFFF, maxUnicode = 0;
for (var i = 0, ii = glyphs.length; i < ii; i++) {
var unicode = glyphs[i].unicode;
minUnicode = Math.min(minUnicode, unicode);
maxUnicode = Math.max(maxUnicode, unicode);
}
// high byte must be the same for min and max unicodes
if ((maxUnicode & 0xFF00) != (minUnicode & 0xFF00))
this.isSymbolicFont = false;
}
// heuristics: if removed more than 2 glyphs encoding WinAnsiEncoding
// does not set properly
if (glyphsRemoved > 2) {

1
test/pdfs/preistabelle.pdf.link

@ -0,0 +1 @@ @@ -0,0 +1 @@
http://www.fyve.de/downloads/Preistabelle_FYVE_Oktober_2010.pdf

8
test/test_manifest.json

@ -480,6 +480,14 @@ @@ -480,6 +480,14 @@
"link": true,
"type": "eq"
},
{ "id": "preistabelle",
"file": "pdfs/preistabelle.pdf",
"md5": "d2f0b2086160d4f3d325c79a5dc1fb4d",
"rounds": 1,
"pageLimit": 2,
"link": true,
"type": "eq"
},
{ "id": "issue925",
"file": "pdfs/issue925.pdf",
"md5": "f58fe943090aff89dcc8e771bc0db4c2",

Loading…
Cancel
Save