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.
Pomax
left a comment
There was a problem hiding this comment.
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. |
|
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.