Browse Source

PDF.js version 1.8.597 - See mozilla/pdf.js@e20d4a9c2119b6b0dd1d11d2d5e21b94375546d8

master v1.8.597
pdfjsbot 8 years ago
parent
commit
42014c119a
  1. 2
      bower.json
  2. 170
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 12
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 4
      build/pdf.min.js
  7. 162
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 12
      build/pdf.worker.min.js
  10. 158
      lib/core/fonts.js
  11. 4
      lib/display/api.js
  12. 4
      lib/display/global.js
  13. 4
      lib/pdf.js
  14. 4
      lib/pdf.worker.js
  15. 2
      package.json

2
bower.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.8.595", "version": "1.8.597",
"main": [ "main": [
"build/pdf.js", "build/pdf.js",
"build/pdf.worker.js" "build/pdf.worker.js"

170
build/pdf.combined.js

@ -7078,8 +7078,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}(); }();
var version, build; var version, build;
{ {
exports.version = version = '1.8.595'; exports.version = version = '1.8.597';
exports.build = build = '5b7f712c'; exports.build = build = 'e20d4a9c';
} }
exports.getDocument = getDocument; exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort; exports.LoopbackPort = LoopbackPort;
@ -28185,8 +28185,8 @@ if (!_util.globalScope.PDFJS) {
} }
var PDFJS = _util.globalScope.PDFJS; var PDFJS = _util.globalScope.PDFJS;
{ {
PDFJS.version = '1.8.595'; PDFJS.version = '1.8.597';
PDFJS.build = '5b7f712c'; PDFJS.build = 'e20d4a9c';
} }
PDFJS.pdfBug = false; PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) { if (PDFJS.verbosity !== undefined) {
@ -35030,9 +35030,7 @@ var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
var ProblematicCharRanges = new Int32Array([0x0000, 0x0020, 0x007F, 0x00A1, 0x00AD, 0x00AE, 0x0600, 0x0780, 0x08A0, 0x10A0, 0x1780, 0x1800, 0x1C00, 0x1C50, 0x2000, 0x2010, 0x2011, 0x2012, 0x2028, 0x2030, 0x205F, 0x2070, 0x25CC, 0x25CD, 0x3000, 0x3001, 0x3164, 0x3165, 0xAA60, 0xAA80, 0xFFF0, 0x10000]); var ProblematicCharRanges = new Int32Array([0x0000, 0x0020, 0x007F, 0x00A1, 0x00AD, 0x00AE, 0x0600, 0x0780, 0x08A0, 0x10A0, 0x1780, 0x1800, 0x1C00, 0x1C50, 0x2000, 0x2010, 0x2011, 0x2012, 0x2028, 0x2030, 0x205F, 0x2070, 0x25CC, 0x25CD, 0x3000, 0x3001, 0x3164, 0x3165, 0xAA60, 0xAA80, 0xFFF0, 0x10000]);
var Font = function FontClosure() { var Font = function FontClosure() {
function Font(name, file, properties) { function Font(name, file, properties) {
var _this = this; var charCode;
var charCode, glyphName, unicode;
this.name = name; this.name = name;
this.loadedName = properties.loadedName; this.loadedName = properties.loadedName;
this.isType3Font = properties.isType3Font; this.isType3Font = properties.isType3Font;
@ -35045,6 +35043,7 @@ var Font = function FontClosure() {
var type = properties.type; var type = properties.type;
var subtype = properties.subtype; var subtype = properties.subtype;
this.type = type; this.type = type;
this.subtype = subtype;
this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif'; this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
this.differences = properties.differences; this.differences = properties.differences;
this.widths = properties.widths; this.widths = properties.widths;
@ -35056,6 +35055,7 @@ var Font = function FontClosure() {
this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
this.fontMatrix = properties.fontMatrix; this.fontMatrix = properties.fontMatrix;
this.bbox = properties.bbox; this.bbox = properties.bbox;
this.defaultEncoding = properties.defaultEncoding;
this.toUnicode = properties.toUnicode; this.toUnicode = properties.toUnicode;
this.toFontChar = []; this.toFontChar = [];
if (properties.type === 'Type3') { if (properties.type === 'Type3') {
@ -35071,66 +35071,11 @@ var Font = function FontClosure() {
this.vmetrics = properties.vmetrics; this.vmetrics = properties.vmetrics;
this.defaultVMetrics = properties.defaultVMetrics; this.defaultVMetrics = properties.defaultVMetrics;
} }
var glyphsUnicodeMap;
if (!file || file.isEmpty) { if (!file || file.isEmpty) {
if (file) { if (file) {
(0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ')'); (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ')');
} }
this.missingFile = true; this.fallbackToSystemFont();
var fontName = name.replace(/[,_]/g, '-');
var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
this.bold = fontName.search(/bold/gi) !== -1;
this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
this.black = name.search(/Black/g) !== -1;
this.remeasure = Object.keys(this.widths).length > 0;
if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
var map = [];
for (charCode in GlyphMapForStandardFonts) {
map[+charCode] = GlyphMapForStandardFonts[charCode];
}
if (/Arial-?Black/i.test(name)) {
var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
for (charCode in SupplementalGlyphMapForArialBlack) {
map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
}
}
var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
if (!isIdentityUnicode) {
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
map[+charCode] = unicodeCharCode;
});
}
this.toFontChar = map;
this.toUnicode = new ToUnicodeMap(map);
} else if (/Symbol/i.test(fontName)) {
this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), properties.differences);
} else if (/Dingbats/i.test(fontName)) {
if (/Wingdings/i.test(name)) {
(0, _util.warn)('Non-embedded Wingdings font, falling back to ZapfDingbats.');
}
this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), properties.differences);
} else if (isStandardFont) {
this.toFontChar = buildToFontChar(properties.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), properties.differences);
} else {
glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
if (!_this.composite) {
glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
if (unicode !== -1) {
unicodeCharCode = unicode;
}
}
_this.toFontChar[charCode] = unicodeCharCode;
});
}
this.loadedName = fontName.split('-')[0];
this.loading = false;
this.fontType = getFontType(type, subtype);
return; return;
} }
if (subtype === 'Type1C') { if (subtype === 'Type1C') {
@ -35159,6 +35104,7 @@ var Font = function FontClosure() {
if (subtype === 'OpenType' && type !== 'OpenType') { if (subtype === 'OpenType' && type !== 'OpenType') {
type = 'OpenType'; type = 'OpenType';
} }
try {
var data; var data;
switch (type) { switch (type) {
case 'MMType1': case 'MMType1':
@ -35183,6 +35129,14 @@ var Font = function FontClosure() {
default: default:
throw new _util.FormatError('Font ' + type + ' is not supported'); throw new _util.FormatError('Font ' + type + ' is not supported');
} }
} catch (e) {
if (!(e instanceof _util.FormatError)) {
throw e;
}
(0, _util.warn)(e);
this.fallbackToSystemFont();
return;
}
this.data = data; this.data = data;
this.fontType = getFontType(type, subtype); this.fontType = getFontType(type, subtype);
this.fontMatrix = properties.fontMatrix; this.fontMatrix = properties.fontMatrix;
@ -35275,6 +35229,9 @@ var Font = function FontClosure() {
for (var originalCharCode in charCodeToGlyphId) { for (var originalCharCode in charCodeToGlyphId) {
originalCharCode |= 0; originalCharCode |= 0;
var glyphId = charCodeToGlyphId[originalCharCode]; var glyphId = charCodeToGlyphId[originalCharCode];
if (missingGlyphs[glyphId]) {
continue;
}
var fontCharCode = originalCharCode; var fontCharCode = originalCharCode;
var hasUnicodeValue = false; var hasUnicodeValue = false;
if (!isIdentityUnicode && toUnicode.has(originalCharCode)) { if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
@ -35284,14 +35241,18 @@ var Font = function FontClosure() {
fontCharCode = unicode.charCodeAt(0); fontCharCode = unicode.charCodeAt(0);
} }
} }
if (!missingGlyphs[glyphId] && (usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) { if (usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) {
do { do {
if (nextAvailableFontCharCode > PRIVATE_USE_OFFSET_END) {
(0, _util.warn)('Ran out of space in font private use area.');
break;
}
fontCharCode = nextAvailableFontCharCode++; fontCharCode = nextAvailableFontCharCode++;
if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) { if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
fontCharCode = 0xF020; fontCharCode = 0xF020;
nextAvailableFontCharCode = fontCharCode + 1; nextAvailableFontCharCode = fontCharCode + 1;
} }
} while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END); } while (usedFontCharCodes[fontCharCode] !== undefined);
} }
newMap[fontCharCode] = glyphId; newMap[fontCharCode] = glyphId;
toFontChar[originalCharCode] = fontCharCode; toFontChar[originalCharCode] = fontCharCode;
@ -35314,6 +35275,12 @@ var Font = function FontClosure() {
glyphId: glyphs[charCode] glyphId: glyphs[charCode]
}); });
} }
if (codes.length === 0) {
codes.push({
fontCharCode: 0,
glyphId: 0
});
}
codes.sort(function fontGetRangesSort(a, b) { codes.sort(function fontGetRangesSort(a, b) {
return a.fontCharCode - b.fontCharCode; return a.fontCharCode - b.fontCharCode;
}); });
@ -35548,6 +35515,69 @@ var Font = function FontClosure() {
} }
return data; return data;
}, },
fallbackToSystemFont: function Font_fallbackToSystemFont() {
var _this = this;
this.missingFile = true;
var charCode, unicode;
var name = this.name;
var type = this.type;
var subtype = this.subtype;
var fontName = name.replace(/[,_]/g, '-');
var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
this.bold = fontName.search(/bold/gi) !== -1;
this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
this.black = name.search(/Black/g) !== -1;
this.remeasure = Object.keys(this.widths).length > 0;
if (isStandardFont && type === 'CIDFontType2' && this.cidEncoding.indexOf('Identity-') === 0) {
var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
var map = [];
for (charCode in GlyphMapForStandardFonts) {
map[+charCode] = GlyphMapForStandardFonts[charCode];
}
if (/Arial-?Black/i.test(name)) {
var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
for (charCode in SupplementalGlyphMapForArialBlack) {
map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
}
}
var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
if (!isIdentityUnicode) {
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
map[+charCode] = unicodeCharCode;
});
}
this.toFontChar = map;
this.toUnicode = new ToUnicodeMap(map);
} else if (/Symbol/i.test(fontName)) {
this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
} else if (/Dingbats/i.test(fontName)) {
if (/Wingdings/i.test(name)) {
(0, _util.warn)('Non-embedded Wingdings font, falling back to ZapfDingbats.');
}
this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
} else if (isStandardFont) {
this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
} else {
var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
if (!_this.composite) {
var glyphName = _this.differences[charCode] || _this.defaultEncoding[charCode];
unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
if (unicode !== -1) {
unicodeCharCode = unicode;
}
}
_this.toFontChar[charCode] = unicodeCharCode;
});
}
this.loadedName = fontName.split('-')[0];
this.loading = false;
this.fontType = getFontType(type, subtype);
},
checkAndRepair: function Font_checkAndRepair(name, font, properties) { checkAndRepair: function Font_checkAndRepair(name, font, properties) {
function readTableEntry(file) { function readTableEntry(file) {
var tag = (0, _util.bytesToString)(file.getBytes(4)); var tag = (0, _util.bytesToString)(file.getBytes(4));
@ -35847,7 +35877,7 @@ var Font = function FontClosure() {
data[50] = 0; data[50] = 0;
data[51] = 1; data[51] = 1;
} else { } else {
(0, _util.warn)('Could not fix indexToLocFormat: ' + indexToLocFormat); throw new _util.FormatError('Could not fix indexToLocFormat: ' + indexToLocFormat);
} }
} }
} }
@ -35887,7 +35917,6 @@ var Font = function FontClosure() {
var startOffset = itemDecode(locaData, 0); var startOffset = itemDecode(locaData, 0);
var writeOffset = 0; var writeOffset = 0;
var missingGlyphData = Object.create(null); var missingGlyphData = Object.create(null);
missingGlyphData[0] = true;
itemEncode(locaData, 0, writeOffset); itemEncode(locaData, 0, writeOffset);
var i, j; var i, j;
var locaCount = dupFirstEntry ? numGlyphs - 1 : numGlyphs; var locaCount = dupFirstEntry ? numGlyphs - 1 : numGlyphs;
@ -36464,9 +36493,6 @@ var Font = function FontClosure() {
found = true; found = true;
} }
} }
if (!found) {
charCodeToGlyphId[charCode] = 0;
}
} }
} else if (cmapPlatformId === 0 && cmapEncodingId === 0) { } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
for (i = 0; i < cmapMappingsLength; ++i) { for (i = 0; i < cmapMappingsLength; ++i) {
@ -47657,8 +47683,8 @@ exports.PDFDataTransportStream = PDFDataTransportStream;
"use strict"; "use strict";
var pdfjsVersion = '1.8.595'; var pdfjsVersion = '1.8.597';
var pdfjsBuild = '5b7f712c'; var pdfjsBuild = 'e20d4a9c';
var pdfjsSharedUtil = __w_pdfjs_require__(0); var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(24); var pdfjsDisplayGlobal = __w_pdfjs_require__(24);
var pdfjsDisplayAPI = __w_pdfjs_require__(7); var pdfjsDisplayAPI = __w_pdfjs_require__(7);

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

12
build/pdf.js

@ -3329,8 +3329,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}(); }();
var version, build; var version, build;
{ {
exports.version = version = '1.8.595'; exports.version = version = '1.8.597';
exports.build = build = '5b7f712c'; exports.build = build = 'e20d4a9c';
} }
exports.getDocument = getDocument; exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort; exports.LoopbackPort = LoopbackPort;
@ -6040,8 +6040,8 @@ if (!_util.globalScope.PDFJS) {
} }
var PDFJS = _util.globalScope.PDFJS; var PDFJS = _util.globalScope.PDFJS;
{ {
PDFJS.version = '1.8.595'; PDFJS.version = '1.8.597';
PDFJS.build = '5b7f712c'; PDFJS.build = 'e20d4a9c';
} }
PDFJS.pdfBug = false; PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) { if (PDFJS.verbosity !== undefined) {
@ -12318,8 +12318,8 @@ exports.PDFDataTransportStream = PDFDataTransportStream;
"use strict"; "use strict";
var pdfjsVersion = '1.8.595'; var pdfjsVersion = '1.8.597';
var pdfjsBuild = '5b7f712c'; var pdfjsBuild = 'e20d4a9c';
var pdfjsSharedUtil = __w_pdfjs_require__(0); var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(8); var pdfjsDisplayGlobal = __w_pdfjs_require__(8);
var pdfjsDisplayAPI = __w_pdfjs_require__(2); var pdfjsDisplayAPI = __w_pdfjs_require__(2);

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

4
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

162
build/pdf.worker.js vendored

@ -30554,9 +30554,7 @@ var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
var ProblematicCharRanges = new Int32Array([0x0000, 0x0020, 0x007F, 0x00A1, 0x00AD, 0x00AE, 0x0600, 0x0780, 0x08A0, 0x10A0, 0x1780, 0x1800, 0x1C00, 0x1C50, 0x2000, 0x2010, 0x2011, 0x2012, 0x2028, 0x2030, 0x205F, 0x2070, 0x25CC, 0x25CD, 0x3000, 0x3001, 0x3164, 0x3165, 0xAA60, 0xAA80, 0xFFF0, 0x10000]); var ProblematicCharRanges = new Int32Array([0x0000, 0x0020, 0x007F, 0x00A1, 0x00AD, 0x00AE, 0x0600, 0x0780, 0x08A0, 0x10A0, 0x1780, 0x1800, 0x1C00, 0x1C50, 0x2000, 0x2010, 0x2011, 0x2012, 0x2028, 0x2030, 0x205F, 0x2070, 0x25CC, 0x25CD, 0x3000, 0x3001, 0x3164, 0x3165, 0xAA60, 0xAA80, 0xFFF0, 0x10000]);
var Font = function FontClosure() { var Font = function FontClosure() {
function Font(name, file, properties) { function Font(name, file, properties) {
var _this = this; var charCode;
var charCode, glyphName, unicode;
this.name = name; this.name = name;
this.loadedName = properties.loadedName; this.loadedName = properties.loadedName;
this.isType3Font = properties.isType3Font; this.isType3Font = properties.isType3Font;
@ -30569,6 +30567,7 @@ var Font = function FontClosure() {
var type = properties.type; var type = properties.type;
var subtype = properties.subtype; var subtype = properties.subtype;
this.type = type; this.type = type;
this.subtype = subtype;
this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif'; this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
this.differences = properties.differences; this.differences = properties.differences;
this.widths = properties.widths; this.widths = properties.widths;
@ -30580,6 +30579,7 @@ var Font = function FontClosure() {
this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
this.fontMatrix = properties.fontMatrix; this.fontMatrix = properties.fontMatrix;
this.bbox = properties.bbox; this.bbox = properties.bbox;
this.defaultEncoding = properties.defaultEncoding;
this.toUnicode = properties.toUnicode; this.toUnicode = properties.toUnicode;
this.toFontChar = []; this.toFontChar = [];
if (properties.type === 'Type3') { if (properties.type === 'Type3') {
@ -30595,66 +30595,11 @@ var Font = function FontClosure() {
this.vmetrics = properties.vmetrics; this.vmetrics = properties.vmetrics;
this.defaultVMetrics = properties.defaultVMetrics; this.defaultVMetrics = properties.defaultVMetrics;
} }
var glyphsUnicodeMap;
if (!file || file.isEmpty) { if (!file || file.isEmpty) {
if (file) { if (file) {
(0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ')'); (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ')');
} }
this.missingFile = true; this.fallbackToSystemFont();
var fontName = name.replace(/[,_]/g, '-');
var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
this.bold = fontName.search(/bold/gi) !== -1;
this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
this.black = name.search(/Black/g) !== -1;
this.remeasure = Object.keys(this.widths).length > 0;
if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
var map = [];
for (charCode in GlyphMapForStandardFonts) {
map[+charCode] = GlyphMapForStandardFonts[charCode];
}
if (/Arial-?Black/i.test(name)) {
var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
for (charCode in SupplementalGlyphMapForArialBlack) {
map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
}
}
var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
if (!isIdentityUnicode) {
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
map[+charCode] = unicodeCharCode;
});
}
this.toFontChar = map;
this.toUnicode = new ToUnicodeMap(map);
} else if (/Symbol/i.test(fontName)) {
this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), properties.differences);
} else if (/Dingbats/i.test(fontName)) {
if (/Wingdings/i.test(name)) {
(0, _util.warn)('Non-embedded Wingdings font, falling back to ZapfDingbats.');
}
this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), properties.differences);
} else if (isStandardFont) {
this.toFontChar = buildToFontChar(properties.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), properties.differences);
} else {
glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
if (!_this.composite) {
glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
if (unicode !== -1) {
unicodeCharCode = unicode;
}
}
_this.toFontChar[charCode] = unicodeCharCode;
});
}
this.loadedName = fontName.split('-')[0];
this.loading = false;
this.fontType = getFontType(type, subtype);
return; return;
} }
if (subtype === 'Type1C') { if (subtype === 'Type1C') {
@ -30683,6 +30628,7 @@ var Font = function FontClosure() {
if (subtype === 'OpenType' && type !== 'OpenType') { if (subtype === 'OpenType' && type !== 'OpenType') {
type = 'OpenType'; type = 'OpenType';
} }
try {
var data; var data;
switch (type) { switch (type) {
case 'MMType1': case 'MMType1':
@ -30707,6 +30653,14 @@ var Font = function FontClosure() {
default: default:
throw new _util.FormatError('Font ' + type + ' is not supported'); throw new _util.FormatError('Font ' + type + ' is not supported');
} }
} catch (e) {
if (!(e instanceof _util.FormatError)) {
throw e;
}
(0, _util.warn)(e);
this.fallbackToSystemFont();
return;
}
this.data = data; this.data = data;
this.fontType = getFontType(type, subtype); this.fontType = getFontType(type, subtype);
this.fontMatrix = properties.fontMatrix; this.fontMatrix = properties.fontMatrix;
@ -30799,6 +30753,9 @@ var Font = function FontClosure() {
for (var originalCharCode in charCodeToGlyphId) { for (var originalCharCode in charCodeToGlyphId) {
originalCharCode |= 0; originalCharCode |= 0;
var glyphId = charCodeToGlyphId[originalCharCode]; var glyphId = charCodeToGlyphId[originalCharCode];
if (missingGlyphs[glyphId]) {
continue;
}
var fontCharCode = originalCharCode; var fontCharCode = originalCharCode;
var hasUnicodeValue = false; var hasUnicodeValue = false;
if (!isIdentityUnicode && toUnicode.has(originalCharCode)) { if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
@ -30808,14 +30765,18 @@ var Font = function FontClosure() {
fontCharCode = unicode.charCodeAt(0); fontCharCode = unicode.charCodeAt(0);
} }
} }
if (!missingGlyphs[glyphId] && (usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) { if (usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) {
do { do {
if (nextAvailableFontCharCode > PRIVATE_USE_OFFSET_END) {
(0, _util.warn)('Ran out of space in font private use area.');
break;
}
fontCharCode = nextAvailableFontCharCode++; fontCharCode = nextAvailableFontCharCode++;
if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) { if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
fontCharCode = 0xF020; fontCharCode = 0xF020;
nextAvailableFontCharCode = fontCharCode + 1; nextAvailableFontCharCode = fontCharCode + 1;
} }
} while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END); } while (usedFontCharCodes[fontCharCode] !== undefined);
} }
newMap[fontCharCode] = glyphId; newMap[fontCharCode] = glyphId;
toFontChar[originalCharCode] = fontCharCode; toFontChar[originalCharCode] = fontCharCode;
@ -30838,6 +30799,12 @@ var Font = function FontClosure() {
glyphId: glyphs[charCode] glyphId: glyphs[charCode]
}); });
} }
if (codes.length === 0) {
codes.push({
fontCharCode: 0,
glyphId: 0
});
}
codes.sort(function fontGetRangesSort(a, b) { codes.sort(function fontGetRangesSort(a, b) {
return a.fontCharCode - b.fontCharCode; return a.fontCharCode - b.fontCharCode;
}); });
@ -31072,6 +31039,69 @@ var Font = function FontClosure() {
} }
return data; return data;
}, },
fallbackToSystemFont: function Font_fallbackToSystemFont() {
var _this = this;
this.missingFile = true;
var charCode, unicode;
var name = this.name;
var type = this.type;
var subtype = this.subtype;
var fontName = name.replace(/[,_]/g, '-');
var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
this.bold = fontName.search(/bold/gi) !== -1;
this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
this.black = name.search(/Black/g) !== -1;
this.remeasure = Object.keys(this.widths).length > 0;
if (isStandardFont && type === 'CIDFontType2' && this.cidEncoding.indexOf('Identity-') === 0) {
var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
var map = [];
for (charCode in GlyphMapForStandardFonts) {
map[+charCode] = GlyphMapForStandardFonts[charCode];
}
if (/Arial-?Black/i.test(name)) {
var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
for (charCode in SupplementalGlyphMapForArialBlack) {
map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
}
}
var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
if (!isIdentityUnicode) {
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
map[+charCode] = unicodeCharCode;
});
}
this.toFontChar = map;
this.toUnicode = new ToUnicodeMap(map);
} else if (/Symbol/i.test(fontName)) {
this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
} else if (/Dingbats/i.test(fontName)) {
if (/Wingdings/i.test(name)) {
(0, _util.warn)('Non-embedded Wingdings font, falling back to ZapfDingbats.');
}
this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
} else if (isStandardFont) {
this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
} else {
var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
if (!_this.composite) {
var glyphName = _this.differences[charCode] || _this.defaultEncoding[charCode];
unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
if (unicode !== -1) {
unicodeCharCode = unicode;
}
}
_this.toFontChar[charCode] = unicodeCharCode;
});
}
this.loadedName = fontName.split('-')[0];
this.loading = false;
this.fontType = getFontType(type, subtype);
},
checkAndRepair: function Font_checkAndRepair(name, font, properties) { checkAndRepair: function Font_checkAndRepair(name, font, properties) {
function readTableEntry(file) { function readTableEntry(file) {
var tag = (0, _util.bytesToString)(file.getBytes(4)); var tag = (0, _util.bytesToString)(file.getBytes(4));
@ -31371,7 +31401,7 @@ var Font = function FontClosure() {
data[50] = 0; data[50] = 0;
data[51] = 1; data[51] = 1;
} else { } else {
(0, _util.warn)('Could not fix indexToLocFormat: ' + indexToLocFormat); throw new _util.FormatError('Could not fix indexToLocFormat: ' + indexToLocFormat);
} }
} }
} }
@ -31411,7 +31441,6 @@ var Font = function FontClosure() {
var startOffset = itemDecode(locaData, 0); var startOffset = itemDecode(locaData, 0);
var writeOffset = 0; var writeOffset = 0;
var missingGlyphData = Object.create(null); var missingGlyphData = Object.create(null);
missingGlyphData[0] = true;
itemEncode(locaData, 0, writeOffset); itemEncode(locaData, 0, writeOffset);
var i, j; var i, j;
var locaCount = dupFirstEntry ? numGlyphs - 1 : numGlyphs; var locaCount = dupFirstEntry ? numGlyphs - 1 : numGlyphs;
@ -31988,9 +32017,6 @@ var Font = function FontClosure() {
found = true; found = true;
} }
} }
if (!found) {
charCodeToGlyphId[charCode] = 0;
}
} }
} else if (cmapPlatformId === 0 && cmapEncodingId === 0) { } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
for (i = 0; i < cmapMappingsLength; ++i) { for (i = 0; i < cmapMappingsLength; ++i) {
@ -39953,8 +39979,8 @@ exports.Type1Parser = Type1Parser;
"use strict"; "use strict";
var pdfjsVersion = '1.8.595'; var pdfjsVersion = '1.8.597';
var pdfjsBuild = '5b7f712c'; var pdfjsBuild = 'e20d4a9c';
var pdfjsCoreWorker = __w_pdfjs_require__(17); var pdfjsCoreWorker = __w_pdfjs_require__(17);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

12
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

158
lib/core/fonts.js

@ -323,9 +323,7 @@ var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
var ProblematicCharRanges = new Int32Array([0x0000, 0x0020, 0x007F, 0x00A1, 0x00AD, 0x00AE, 0x0600, 0x0780, 0x08A0, 0x10A0, 0x1780, 0x1800, 0x1C00, 0x1C50, 0x2000, 0x2010, 0x2011, 0x2012, 0x2028, 0x2030, 0x205F, 0x2070, 0x25CC, 0x25CD, 0x3000, 0x3001, 0x3164, 0x3165, 0xAA60, 0xAA80, 0xFFF0, 0x10000]); var ProblematicCharRanges = new Int32Array([0x0000, 0x0020, 0x007F, 0x00A1, 0x00AD, 0x00AE, 0x0600, 0x0780, 0x08A0, 0x10A0, 0x1780, 0x1800, 0x1C00, 0x1C50, 0x2000, 0x2010, 0x2011, 0x2012, 0x2028, 0x2030, 0x205F, 0x2070, 0x25CC, 0x25CD, 0x3000, 0x3001, 0x3164, 0x3165, 0xAA60, 0xAA80, 0xFFF0, 0x10000]);
var Font = function FontClosure() { var Font = function FontClosure() {
function Font(name, file, properties) { function Font(name, file, properties) {
var _this = this; var charCode;
var charCode, glyphName, unicode;
this.name = name; this.name = name;
this.loadedName = properties.loadedName; this.loadedName = properties.loadedName;
this.isType3Font = properties.isType3Font; this.isType3Font = properties.isType3Font;
@ -338,6 +336,7 @@ var Font = function FontClosure() {
var type = properties.type; var type = properties.type;
var subtype = properties.subtype; var subtype = properties.subtype;
this.type = type; this.type = type;
this.subtype = subtype;
this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif'; this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
this.differences = properties.differences; this.differences = properties.differences;
this.widths = properties.widths; this.widths = properties.widths;
@ -349,6 +348,7 @@ var Font = function FontClosure() {
this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
this.fontMatrix = properties.fontMatrix; this.fontMatrix = properties.fontMatrix;
this.bbox = properties.bbox; this.bbox = properties.bbox;
this.defaultEncoding = properties.defaultEncoding;
this.toUnicode = properties.toUnicode; this.toUnicode = properties.toUnicode;
this.toFontChar = []; this.toFontChar = [];
if (properties.type === 'Type3') { if (properties.type === 'Type3') {
@ -364,66 +364,11 @@ var Font = function FontClosure() {
this.vmetrics = properties.vmetrics; this.vmetrics = properties.vmetrics;
this.defaultVMetrics = properties.defaultVMetrics; this.defaultVMetrics = properties.defaultVMetrics;
} }
var glyphsUnicodeMap;
if (!file || file.isEmpty) { if (!file || file.isEmpty) {
if (file) { if (file) {
(0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ')'); (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ')');
} }
this.missingFile = true; this.fallbackToSystemFont();
var fontName = name.replace(/[,_]/g, '-');
var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
this.bold = fontName.search(/bold/gi) !== -1;
this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
this.black = name.search(/Black/g) !== -1;
this.remeasure = Object.keys(this.widths).length > 0;
if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
var map = [];
for (charCode in GlyphMapForStandardFonts) {
map[+charCode] = GlyphMapForStandardFonts[charCode];
}
if (/Arial-?Black/i.test(name)) {
var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
for (charCode in SupplementalGlyphMapForArialBlack) {
map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
}
}
var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
if (!isIdentityUnicode) {
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
map[+charCode] = unicodeCharCode;
});
}
this.toFontChar = map;
this.toUnicode = new ToUnicodeMap(map);
} else if (/Symbol/i.test(fontName)) {
this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), properties.differences);
} else if (/Dingbats/i.test(fontName)) {
if (/Wingdings/i.test(name)) {
(0, _util.warn)('Non-embedded Wingdings font, falling back to ZapfDingbats.');
}
this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), properties.differences);
} else if (isStandardFont) {
this.toFontChar = buildToFontChar(properties.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), properties.differences);
} else {
glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
if (!_this.composite) {
glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
if (unicode !== -1) {
unicodeCharCode = unicode;
}
}
_this.toFontChar[charCode] = unicodeCharCode;
});
}
this.loadedName = fontName.split('-')[0];
this.loading = false;
this.fontType = getFontType(type, subtype);
return; return;
} }
if (subtype === 'Type1C') { if (subtype === 'Type1C') {
@ -452,6 +397,7 @@ var Font = function FontClosure() {
if (subtype === 'OpenType' && type !== 'OpenType') { if (subtype === 'OpenType' && type !== 'OpenType') {
type = 'OpenType'; type = 'OpenType';
} }
try {
var data; var data;
switch (type) { switch (type) {
case 'MMType1': case 'MMType1':
@ -476,6 +422,14 @@ var Font = function FontClosure() {
default: default:
throw new _util.FormatError('Font ' + type + ' is not supported'); throw new _util.FormatError('Font ' + type + ' is not supported');
} }
} catch (e) {
if (!(e instanceof _util.FormatError)) {
throw e;
}
(0, _util.warn)(e);
this.fallbackToSystemFont();
return;
}
this.data = data; this.data = data;
this.fontType = getFontType(type, subtype); this.fontType = getFontType(type, subtype);
this.fontMatrix = properties.fontMatrix; this.fontMatrix = properties.fontMatrix;
@ -568,6 +522,9 @@ var Font = function FontClosure() {
for (var originalCharCode in charCodeToGlyphId) { for (var originalCharCode in charCodeToGlyphId) {
originalCharCode |= 0; originalCharCode |= 0;
var glyphId = charCodeToGlyphId[originalCharCode]; var glyphId = charCodeToGlyphId[originalCharCode];
if (missingGlyphs[glyphId]) {
continue;
}
var fontCharCode = originalCharCode; var fontCharCode = originalCharCode;
var hasUnicodeValue = false; var hasUnicodeValue = false;
if (!isIdentityUnicode && toUnicode.has(originalCharCode)) { if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
@ -577,14 +534,18 @@ var Font = function FontClosure() {
fontCharCode = unicode.charCodeAt(0); fontCharCode = unicode.charCodeAt(0);
} }
} }
if (!missingGlyphs[glyphId] && (usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) { if (usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) {
do { do {
if (nextAvailableFontCharCode > PRIVATE_USE_OFFSET_END) {
(0, _util.warn)('Ran out of space in font private use area.');
break;
}
fontCharCode = nextAvailableFontCharCode++; fontCharCode = nextAvailableFontCharCode++;
if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) { if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
fontCharCode = 0xF020; fontCharCode = 0xF020;
nextAvailableFontCharCode = fontCharCode + 1; nextAvailableFontCharCode = fontCharCode + 1;
} }
} while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END); } while (usedFontCharCodes[fontCharCode] !== undefined);
} }
newMap[fontCharCode] = glyphId; newMap[fontCharCode] = glyphId;
toFontChar[originalCharCode] = fontCharCode; toFontChar[originalCharCode] = fontCharCode;
@ -607,6 +568,12 @@ var Font = function FontClosure() {
glyphId: glyphs[charCode] glyphId: glyphs[charCode]
}); });
} }
if (codes.length === 0) {
codes.push({
fontCharCode: 0,
glyphId: 0
});
}
codes.sort(function fontGetRangesSort(a, b) { codes.sort(function fontGetRangesSort(a, b) {
return a.fontCharCode - b.fontCharCode; return a.fontCharCode - b.fontCharCode;
}); });
@ -841,6 +808,69 @@ var Font = function FontClosure() {
} }
return data; return data;
}, },
fallbackToSystemFont: function Font_fallbackToSystemFont() {
var _this = this;
this.missingFile = true;
var charCode, unicode;
var name = this.name;
var type = this.type;
var subtype = this.subtype;
var fontName = name.replace(/[,_]/g, '-');
var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
this.bold = fontName.search(/bold/gi) !== -1;
this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
this.black = name.search(/Black/g) !== -1;
this.remeasure = Object.keys(this.widths).length > 0;
if (isStandardFont && type === 'CIDFontType2' && this.cidEncoding.indexOf('Identity-') === 0) {
var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
var map = [];
for (charCode in GlyphMapForStandardFonts) {
map[+charCode] = GlyphMapForStandardFonts[charCode];
}
if (/Arial-?Black/i.test(name)) {
var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
for (charCode in SupplementalGlyphMapForArialBlack) {
map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
}
}
var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
if (!isIdentityUnicode) {
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
map[+charCode] = unicodeCharCode;
});
}
this.toFontChar = map;
this.toUnicode = new ToUnicodeMap(map);
} else if (/Symbol/i.test(fontName)) {
this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
} else if (/Dingbats/i.test(fontName)) {
if (/Wingdings/i.test(name)) {
(0, _util.warn)('Non-embedded Wingdings font, falling back to ZapfDingbats.');
}
this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
} else if (isStandardFont) {
this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
} else {
var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
if (!_this.composite) {
var glyphName = _this.differences[charCode] || _this.defaultEncoding[charCode];
unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
if (unicode !== -1) {
unicodeCharCode = unicode;
}
}
_this.toFontChar[charCode] = unicodeCharCode;
});
}
this.loadedName = fontName.split('-')[0];
this.loading = false;
this.fontType = getFontType(type, subtype);
},
checkAndRepair: function Font_checkAndRepair(name, font, properties) { checkAndRepair: function Font_checkAndRepair(name, font, properties) {
function readTableEntry(file) { function readTableEntry(file) {
var tag = (0, _util.bytesToString)(file.getBytes(4)); var tag = (0, _util.bytesToString)(file.getBytes(4));
@ -1140,7 +1170,7 @@ var Font = function FontClosure() {
data[50] = 0; data[50] = 0;
data[51] = 1; data[51] = 1;
} else { } else {
(0, _util.warn)('Could not fix indexToLocFormat: ' + indexToLocFormat); throw new _util.FormatError('Could not fix indexToLocFormat: ' + indexToLocFormat);
} }
} }
} }
@ -1180,7 +1210,6 @@ var Font = function FontClosure() {
var startOffset = itemDecode(locaData, 0); var startOffset = itemDecode(locaData, 0);
var writeOffset = 0; var writeOffset = 0;
var missingGlyphData = Object.create(null); var missingGlyphData = Object.create(null);
missingGlyphData[0] = true;
itemEncode(locaData, 0, writeOffset); itemEncode(locaData, 0, writeOffset);
var i, j; var i, j;
var locaCount = dupFirstEntry ? numGlyphs - 1 : numGlyphs; var locaCount = dupFirstEntry ? numGlyphs - 1 : numGlyphs;
@ -1757,9 +1786,6 @@ var Font = function FontClosure() {
found = true; found = true;
} }
} }
if (!found) {
charCodeToGlyphId[charCode] = 0;
}
} }
} else if (cmapPlatformId === 0 && cmapEncodingId === 0) { } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
for (i = 0; i < cmapMappingsLength; ++i) { for (i = 0; i < cmapMappingsLength; ++i) {

4
lib/display/api.js

@ -1574,8 +1574,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}(); }();
var version, build; var version, build;
{ {
exports.version = version = '1.8.595'; exports.version = version = '1.8.597';
exports.build = build = '5b7f712c'; exports.build = build = 'e20d4a9c';
} }
exports.getDocument = getDocument; exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort; exports.LoopbackPort = LoopbackPort;

4
lib/display/global.js

@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) {
} }
var PDFJS = _util.globalScope.PDFJS; var PDFJS = _util.globalScope.PDFJS;
{ {
PDFJS.version = '1.8.595'; PDFJS.version = '1.8.597';
PDFJS.build = '5b7f712c'; PDFJS.build = 'e20d4a9c';
} }
PDFJS.pdfBug = false; PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) { if (PDFJS.verbosity !== undefined) {

4
lib/pdf.js

@ -14,8 +14,8 @@
*/ */
'use strict'; 'use strict';
var pdfjsVersion = '1.8.595'; var pdfjsVersion = '1.8.597';
var pdfjsBuild = '5b7f712c'; var pdfjsBuild = 'e20d4a9c';
var pdfjsSharedUtil = require('./shared/util.js'); var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js'); var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js'); var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -14,7 +14,7 @@
*/ */
'use strict'; 'use strict';
var pdfjsVersion = '1.8.595'; var pdfjsVersion = '1.8.597';
var pdfjsBuild = '5b7f712c'; var pdfjsBuild = 'e20d4a9c';
var pdfjsCoreWorker = require('./core/worker.js'); var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.8.595", "version": "1.8.597",
"main": "build/pdf.js", "main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.", "description": "Generic build of Mozilla's PDF.js library.",
"keywords": [ "keywords": [

Loading…
Cancel
Save