-
-
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
Fonts that trip up LibFont #114
Comments
Hm, running test.js on those fonts reveals that woff2 files aren't actually being decoded properly at all, so that's something to dig into. |
I've filed #115 for fixing woff2 parsing |
@RoelN so it looks like at least in the browser all those fonts work fine, but the two "numbers only" fonts don't have GSUB tables, so if your testing doesn't check whether
and
|
closing this issue as the code fixes for woff2 support are handled in #115 instead. |
We might have cheered too soon! Two fonts still trip up LibFont. For instance, the Proxima Nova one: import { Font } from "./lib-font.js";
const font = new Font("woff2 testing");
// font.src = `./fonts/broken/BrushPosterGrotesk.woff2`;
// font.src = `./fonts/broken/64017d81-9430-4cba-8219-8f5cc28b923e.woff2`;
// font.src = `./fonts/broken/135abd30-1390-4f9c-b6a2-d843157c3468.woff2`;
font.src = `./fonts/broken/proximanova-regular-webfont.woff2`;
font.onerror = (evt) => console.error(evt);
font.onload = (evt) => {
let font = evt.detail.font;
const { name } = font.opentype.tables;
console.log(name);
}; gives: $ node test.js
parser getUint16 2 Parser {
name: 'name',
length: 1638,
start: 0,
offset: 1640,
data: DataView {
byteLength: 1638,
byteOffset: 0,
buffer: ArrayBuffer {
[Uint8Contents]: <01 7c 01 7d 01 7e 01 7f 01 80 01 81 01 82 01 83 01 84 01 85 01 86 01 87 01 88 01 89 01 8a 01 8b 01 8c 01 8d 01 8e 01 8f 01 90 01 91 01 92 00 d8 00 e1 01 93 01 94 00 db 00 dc 00 dd 00 e0 00 d9 00 df 01 95 01 96 01 97 01 98 01 99 01 9a 01 9b 01 9c 01 9d 01 9e 01 9f 01 a0 01 a1 01 a2 01 a3 01 a4 01 a5 ... 1538 more bytes>,
byteLength: 1638
}
}
}
parser 0 1640
Event {
type: 'error',
detail: RangeError: Offset is outside the bounds of the DataView
at DataView.getUint16 (<anonymous>)
at Parser.getValue (file:///Users/roel/code/lib-font/src/parser.js:60:29)
at Parser.get (file:///Users/roel/code/lib-font/src/parser.js:38:25)
at new NameRecord (file:///Users/roel/code/lib-font/src/opentype/tables/simple/name.js:60:25)
at file:///Users/roel/code/lib-font/src/opentype/tables/simple/name.js:20:14
at Array.map (<anonymous>)
at new name (file:///Users/roel/code/lib-font/src/opentype/tables/simple/name.js:19:51)
at createTable (file:///Users/roel/code/lib-font/src/opentype/tables/createTable.js:88:20)
at file:///Users/roel/code/lib-font/src/opentype/woff2.js:125:14
at Object.get (file:///Users/roel/code/lib-font/src/lazy.js:15:13),
msg: 'Failed to load font at ./fonts/broken/proximanova-regular-webfont.woff2'
} A similar error is given for Not sure if this is related to the WOFF2 handling, or something to the name table code specifically? |
I added some more fonts to test with! |
I've had to remove some links from your updated list, because they contained a number of heavily licensed fonts that may most certainly not be redistributed =) |
Flaticon investigation issue: #120 |
Thanks @Pomax, this is working nicely! I've integrated it in my local Wakamai Fondue build, and all fond that previously broke it, are now working fine! |
These come back from some automated tests, so for most I haven't dug into what exactly goes wrong. My hunch is something with the name table?
Fonts that don't work 😿
Fonts that work 🎉
For completeness sake, a similar issue over at Wakamai Fondue that uses LibFont under the hood: Wakamai-Fondue/wakamai-fondue-site#21 This contains some more (free/open source) fonts we can test with.
The text was updated successfully, but these errors were encountered: