-
Notifications
You must be signed in to change notification settings - Fork 221
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
Fix Noto font bug #230
Fix Noto font bug #230
Conversation
LGTM. The only thing i think is missing is a test. You can look at existing ones as a base |
🤙 |
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?
@blikblum bump, we're forking fontkit and pdfkit for now so we can use this fix, any word on merge and release so pdfkit can be updated? |
I dont have rights to commit to fontkit, only pdfkit |
@devongovett can help to merge this and release a new version ? |
we need this to support Noto |
@calvin-oen You can use up-to-date fork https://github.com/foliojs-fork/fontkit. |
This reverts commit 35b5f34.
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
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 intopDict.FDArray
andused_subrs
weren't really the ones corresponding to the currentfd
. So we are saving a dictionary to find the real index were those values were stored.What do you think about this fix?