-
Notifications
You must be signed in to change notification settings - Fork 223
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 reference error for certain fonts #286
Fix reference error for certain fonts #286
Conversation
It might make sense to preallocate all the variables outside the switch, as that would have been the effective behaviour when babel transpiled to |
…ch, so as to mimic the old behavior when Babel would transpile `let` to `var`. See foliojs#282.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have PR merging powers, but happy to review.
Any opportunity to move from scope-hoisting to block scoped vars is a good opportunity I'd say, but I'll let @devongovett decide whether that's something he would like to see in this PR. |
Hi @devongovett, would you mind taking a look at this? It is causing most of our pdfkit projects that rely on OTF fonts to fail. I'm hoping we can get this merged in soon, then get foliojs/pdfkit#1367 updated and merged as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
It is possible to make a new release with this PR ?
still occurs (for example with the font Thanks in advance! |
Fixes #282.
This branch fixes a ReferenceError that gets thrown when parsing certain fonts, including the Playfair Display font that is in the fontkit repository. The error started happening when version 1.9.0 of fontkit was released.
The fix involved refactoring the
parse()
function to use block-scoping inside the switch case statements in that function. See the MDN docs on redeclarations.