Fix a problem about Japanese PDFs without embedded fonts

This commit is contained in:
vyv03354 2013-01-12 20:12:04 +09:00 committed by Yury Delendik
parent d111003cdb
commit 0980b4c322
2 changed files with 13 additions and 4 deletions

View File

@ -791,6 +791,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}; };
} }
var cidEncoding = baseDict.get('Encoding');
if (isName(cidEncoding))
properties.cidEncoding = cidEncoding.name;
var cidToGidMap = dict.get('CIDToGIDMap'); var cidToGidMap = dict.get('CIDToGIDMap');
if (isStream(cidToGidMap)) if (isStream(cidToGidMap))
properties.cidToGidMap = this.readCidToGidMap(cidToGidMap); properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);

View File

@ -4126,6 +4126,15 @@ var Font = (function FontClosure() {
} else } else
cid++; cid++;
} }
var cidEncoding = properties.cidEncoding;
if (cidEncoding && cidEncoding.indexOf('Uni') === 0) {
// input is already Unicode for Uni* CMap encodings.
// However, Unicode-to-CID conversion is needed
// regardless of the CMap encoding. So we can't reset
// unicodeToCID.
this.cidToUnicode = [];
}
}, },
bindDOM: function Font_bindDOM() { bindDOM: function Font_bindDOM() {
@ -4205,16 +4214,12 @@ var Font = (function FontClosure() {
case 'CIDFontType0': case 'CIDFontType0':
if (this.noUnicodeAdaptation) { if (this.noUnicodeAdaptation) {
width = this.widths[this.unicodeToCID[charcode] || charcode]; width = this.widths[this.unicodeToCID[charcode] || charcode];
fontCharCode = mapPrivateUseChars(charcode);
break;
} }
fontCharCode = this.toFontChar[charcode] || charcode; fontCharCode = this.toFontChar[charcode] || charcode;
break; break;
case 'CIDFontType2': case 'CIDFontType2':
if (this.noUnicodeAdaptation) { if (this.noUnicodeAdaptation) {
width = this.widths[this.unicodeToCID[charcode] || charcode]; width = this.widths[this.unicodeToCID[charcode] || charcode];
fontCharCode = mapPrivateUseChars(charcode);
break;
} }
fontCharCode = this.toFontChar[charcode] || charcode; fontCharCode = this.toFontChar[charcode] || charcode;
break; break;