Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put the string name of the glyph in the charset array. #10604

Merged
merged 1 commit into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/core/cff_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ var CFFStrings = (function CFFStringsClosure() {
return -1;
},
add: function CFFStrings_add(value) {
return this.strings.push(value) + NUM_STANDARD_CFF_STRINGS - 1;
this.strings.push(value);
},
get count() {
return this.strings.length;
Expand Down Expand Up @@ -1616,14 +1616,18 @@ var CFFCompiler = (function CFFCompilerClosure() {
out[0] = 0; // format 0
let charsetIndex = 0;
let numCharsets = charset.charset.length;
let warned = false;
for (let i = 1; i < out.length; i += 2) {
let sid = 0;
if (charsetIndex < numCharsets) {
let name = charset.charset[charsetIndex++];
sid = strings.getSID(name);
if (sid === -1) {
sid = 0;
warn(`Couldn't find ${name} in CFF strings`);
if (!warned) {
warned = true;
warn(`Couldn't find ${name} in CFF strings`);
}
}
}
out[i] = (sid >> 8) & 0xFF;
Expand Down
9 changes: 5 additions & 4 deletions src/core/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3335,14 +3335,15 @@ var Type1Font = (function Type1FontClosure() {
cff.globalSubrIndex = new CFFIndex();

var count = glyphs.length;
var charsetArray = [0];
var charsetArray = ['.notdef'];
var i, ii;
for (i = 0; i < count; i++) {
var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
let glyphName = charstrings[i].glyphName;
let index = CFFStandardStrings.indexOf(glyphName);
if (index === -1) {
index = strings.add(charstrings[i].glyphName);
strings.add(glyphName);
}
charsetArray.push(index);
charsetArray.push(glyphName);
}
cff.charset = new CFFCharset(false, 0, charsetArray);

Expand Down