1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Merge pull request #5150 from nnethercote/toUnicode

Fix #4935
This commit is contained in:
Yury Delendik 2014-08-10 14:07:26 -05:00
commit 4ce1b1e987
2 changed files with 86 additions and 40 deletions

View file

@ -20,8 +20,8 @@
isNum, isStream, isString, JpegStream, Lexer, Metrics,
MurmurHash3_64, Name, Parser, Pattern, PDFImage, PDFJS, serifFonts,
stdFontMap, symbolsFonts, getTilingPatternIR, warn, Util, Promise,
RefSetCache, isRef, TextRenderingMode, CMapFactory, OPS,
UNSUPPORTED_FEATURES, UnsupportedManager, NormalizedUnicodes,
RefSetCache, isRef, TextRenderingMode, ToUnicodeMap, CMapFactory,
OPS, UNSUPPORTED_FEATURES, UnsupportedManager, NormalizedUnicodes,
IDENTITY_MATRIX, reverseIfRtl, createPromiseCapability,
getFontType */
@ -1309,12 +1309,13 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
},
readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
var cmapObj = toUnicode;
var cmap, cmapObj = toUnicode;
if (isName(cmapObj)) {
return CMapFactory.create(cmapObj,
cmap = CMapFactory.create(cmapObj,
{ url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).getMap();
return new ToUnicodeMap(cmap);
} else if (isStream(cmapObj)) {
var cmap = CMapFactory.create(cmapObj,
cmap = CMapFactory.create(cmapObj,
{ url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).getMap();
// Convert UTF-16BE
// NOTE: cmap can be a sparse array, so use forEach instead of for(;;)
@ -1333,7 +1334,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
cmap[i] = String.fromCharCode.apply(String, str);
});
return cmap;
return new ToUnicodeMap(cmap);
}
return null;
},