mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Create the glyph mapping correctly for composite Type1, i.e. CIDFontType0, fonts (issue 11740)
This updates `Type1Font.getGlyphMapping` with a code-path "borrowed" from `CFFFont.getGlyphMapping`.
This commit is contained in:
parent
6a8c591301
commit
938d519192
4 changed files with 23 additions and 0 deletions
|
@ -3635,6 +3635,22 @@ var Type1Font = (function Type1FontClosure() {
|
|||
|
||||
getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
|
||||
var charstrings = this.charstrings;
|
||||
|
||||
if (properties.composite) {
|
||||
const charCodeToGlyphId = Object.create(null);
|
||||
// Map CIDs directly to GIDs.
|
||||
for (
|
||||
let glyphId = 0, charstringsLen = charstrings.length;
|
||||
glyphId < charstringsLen;
|
||||
glyphId++
|
||||
) {
|
||||
const charCode = properties.cMap.charCodeOf(glyphId);
|
||||
// Add 1 because glyph 0 is duplicated.
|
||||
charCodeToGlyphId[charCode] = glyphId + 1;
|
||||
}
|
||||
return charCodeToGlyphId;
|
||||
}
|
||||
|
||||
var glyphNames = [".notdef"],
|
||||
glyphId;
|
||||
for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue