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