mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #14025 from Snuffleupagus/issue-11915
Improve glyph mapping for non-embedded composite standard fonts with a /CIDToGIDMap (issue 11915)
This commit is contained in:
commit
d6a27860e3
4 changed files with 22 additions and 0 deletions
|
@ -1073,6 +1073,7 @@ class Font {
|
|||
map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
|
||||
}
|
||||
}
|
||||
|
||||
// Always update the glyph mapping with the `cidToGidMap` when it exists
|
||||
// (fixes issue12418_reduced.pdf).
|
||||
if (cidToGidMap) {
|
||||
|
@ -1082,6 +1083,20 @@ class Font {
|
|||
map[+charCode] = cidToGidMap[cid];
|
||||
}
|
||||
}
|
||||
// When the /CIDToGIDMap is "incomplete", fallback to the included
|
||||
// /ToUnicode-map regardless of its encoding (fixes issue11915.pdf).
|
||||
if (
|
||||
cidToGidMap.length !== this.toUnicode.length &&
|
||||
properties.hasIncludedToUnicodeMap &&
|
||||
this.toUnicode instanceof IdentityToUnicodeMap
|
||||
) {
|
||||
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
|
||||
const cid = map[charCode];
|
||||
if (cidToGidMap[cid] === undefined) {
|
||||
map[+charCode] = unicodeCharCode;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!(this.toUnicode instanceof IdentityToUnicodeMap)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue