mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Improve glyph mapping for non-embedded composite standard fonts (issue 11088)
For non-embedded CIDFontType2 fonts with a non-/Identity encoding, use the /ToUnicode data to improve the glyph mapping.
This commit is contained in:
parent
d95f680d66
commit
69034ab8dc
3 changed files with 22 additions and 3 deletions
|
@ -1084,8 +1084,7 @@ class Font {
|
|||
}
|
||||
}
|
||||
|
||||
const isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
|
||||
if (!isIdentityUnicode) {
|
||||
if (!(this.toUnicode instanceof IdentityToUnicodeMap)) {
|
||||
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
|
||||
map[+charCode] = unicodeCharCode;
|
||||
});
|
||||
|
@ -1108,11 +1107,22 @@ class Font {
|
|||
this.differences
|
||||
);
|
||||
} else if (isStandardFont) {
|
||||
this.toFontChar = buildToFontChar(
|
||||
const map = buildToFontChar(
|
||||
this.defaultEncoding,
|
||||
getGlyphsUnicode(),
|
||||
this.differences
|
||||
);
|
||||
|
||||
if (
|
||||
type === "CIDFontType2" &&
|
||||
!this.cidEncoding.startsWith("Identity-") &&
|
||||
!(this.toUnicode instanceof IdentityToUnicodeMap)
|
||||
) {
|
||||
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
|
||||
map[+charCode] = unicodeCharCode;
|
||||
});
|
||||
}
|
||||
this.toFontChar = map;
|
||||
} else {
|
||||
const glyphsUnicodeMap = getGlyphsUnicode();
|
||||
const map = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue