mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #13168 from janpe2/ttf-uni-glyphs
Use post table when Encoding has only Differences
This commit is contained in:
commit
5a64157a2f
4 changed files with 21 additions and 7 deletions
|
@ -2901,14 +2901,21 @@ var Font = (function FontClosure() {
|
|||
}
|
||||
|
||||
// Last, try to map any missing charcodes using the post table.
|
||||
if (properties.glyphNames && baseEncoding.length) {
|
||||
if (
|
||||
properties.glyphNames &&
|
||||
(baseEncoding.length || this.differences.length)
|
||||
) {
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
if (charCodeToGlyphId[i] === undefined && baseEncoding[i]) {
|
||||
glyphName = baseEncoding[i];
|
||||
const glyphId = properties.glyphNames.indexOf(glyphName);
|
||||
if (glyphId > 0 && hasGlyph(glyphId)) {
|
||||
charCodeToGlyphId[i] = glyphId;
|
||||
}
|
||||
if (charCodeToGlyphId[i] !== undefined) {
|
||||
continue;
|
||||
}
|
||||
glyphName = this.differences[i] || baseEncoding[i];
|
||||
if (!glyphName) {
|
||||
continue;
|
||||
}
|
||||
const glyphId = properties.glyphNames.indexOf(glyphName);
|
||||
if (glyphId > 0 && hasGlyph(glyphId)) {
|
||||
charCodeToGlyphId[i] = glyphId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue