-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A little bit of context. While working with pdfkit we found this error. foliojs/pdfkit#1106 We narrowed down the repro to fontkit with this little script ``` const fs = require('fs'); const notosans = require('fontkit').openSync('./NotoSansCJKsc-Bold.otf'); const subsetFor = (text, file) => { const run = notosans.layout(text); const subset = notosans.createSubset(); run.glyphs.forEach((glyph) => subset.includeGlyph(glyph)); subset.encodeStream().pipe(fs.createWriteStream(file)); }; subsetFor('间。楼', 'output.ttf'); ``` With this script you can see that glyphs were missing on the subset font if you opened the font with something like fontforge Regarding the logic behind this fix, when `!used_fds[fd]` was false, last items in `topDict.FDArray` and `used_subrs` weren't really the ones corresponding to the current `fd`. So we are saving a dictionary to find the real index were those values were stored. What do you think about this fix?
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.formatOnSave": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters