-
Notifications
You must be signed in to change notification settings - Fork 212
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
How to catch errors like - Failed to deserialize table, cannot read property records... #69
Comments
Noticing that when the script fails, it kills the process so all fonts after that are not being loaded. Looking at where the script fails, the font that seems to be the culprit is in the attached zip file. |
Here are a couple of references to the OTS parsing error: |
Looking at this... |
Those OTS issues aren't caused by fontkit. OTS is a font validator used by Chrome to prevent security issues with web fonts. If you have an issue with fontkit specifically, could you post a code example demonstrating the problem and the font in question? Thanks! |
Was just wondering if you had any kind of listener for those warnings and a way to suppress them. |
After creating a font object, is there a way to get the font file path back out of the object? Been digging around in the object and there's a lot in there. Assumed you had to have it stored in there somewhere. |
fontkit objects can be created in many ways, including from files or buffers. The filename is not held onto once the font is read into memory. You'll need to do that yourself. |
To prevent this, you can wrap the property call in a try-catch block
|
I'm attempting to pull local fonts into an Electron app. All is working except, obviously, some of the fonts are not serializable and also seeing a cannot read property records of undefined.
Serialize errors from inspector look like:
undefined error looks like (I replaced the full path with 'localPath' before pasting here):
I looked and it seems there is a font.fullName property but not a font.name property, so it seems to be assuming that if there's a fullName there has to be a .name property and I guess that's not guaranteed. Almost all the fonts are loading and working correctly. It's just the ones above that aren't.
I was getting an error when a fullName property was undefined but I added a check for that and it fixed that issue....
I tried adding...
... but it doesn't seem to keep it from proceeding.
This is an app that could be run on several different machines so font sets will vary. I'd like a more elegant way to allow these to fail and then just jump out of using that particular font file. Just fyi, I'm only processing otf, ttf, woff and woff2 files. Everything else gets removed from the array.
The text was updated successfully, but these errors were encountered: