-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
fixed the woff2 parsing? #116
Conversation
constructor(name, dict, dataview) { | ||
const { p, tableStart } = super(name, dict, dataview); | ||
constructor(dict, dataview, name) { | ||
const { p, tableStart } = super(dict, dataview, name); |
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.
how the hell did this work before? O_o
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.
¯_(ツ)_/¯
Browser on the left, Node on the right:
|
if (!brotliDecode) { | ||
import("zlib").then((zlib) => { | ||
nativeBrotliDecode = (buffer) => zlib.brotliDecompressSync(buffer); | ||
}); | ||
} |
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.
This is a dynamic import, but for a native module, so while in theory this might kick in "after everything else": in reality it gets executed immediately.
src/opentype/woff2.js
Outdated
const start = entry.offset; | ||
const end = start + (entry.transformLength ? entry.transformLength : entry.origLength); | ||
const data = decoded.slice(start, end); |
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.
Note that this does not have any code in place to deal with transformed glyf
, loca
, or hmtx
tables yet. I've filed #118 to address that in the future.
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.
constructor(name, dict, dataview) { | ||
const { p, tableStart } = super(name, dict, dataview); | ||
constructor(dict, dataview, name) { | ||
const { p, tableStart } = super(dict, dataview, name); |
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.
¯_(ツ)_/¯
closes #115 by updating the woff2 table data parsing code, as well as using Node's native brotli decoding (via the
zlib
module) rather than trying toimport
thelib/unbrotli.js
file, which isn't a module.\@RoelN if you create a dir called
fonts/broken
and put the fonts from #114 in there, the newnpm run test:manual
should allow you to verify things work in the browser, with the followingtest.js
file that you can run withnode test.js
to verify things work on the node side, too: