-
Notifications
You must be signed in to change notification settings - Fork 220
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
font.familyName on Wingdings and other fonts not in UTF8 #84
Comments
Hmm, the hope was to avoid that. This commit changed the behavior to prefer strings over buffers: ff92ff5#diff-7e48a0b8d3d1d1ca0b56eefcf0328fcfR89. Can you confirm that it was previously returning strings before 1.5.5 and is now returning buffers? If not, you may just need to install |
No, it's returning buffers in 1.5.4, 1.5.5, and 1.5.7. Seems as through records with nameID = 1 has the font name in a Buffer that's actually UTF8 convertible. Perhaps that can be a fallback? |
Have you tried using |
Yes, but I got gibberish. Digging into it some more, the encoding appears to be UTF 16 Big Endian, which is not a native nodejs conversion. |
Oh, that's a good point: everything in OpenType uses big endian ordering, even on hardware that does not use that ordering natively... I filed nodejs/node#12813 in the hopes that a next version of Node can address that, One comment there was that https://nodejs.org/api/buffer.html#buffer_buf_swap16 is available for this purpose. |
@roncli I want to figure out why it is returning a buffer in the first place instead of decoding it. Can you please email me the exact font you're using? devongovett@gmail.com. |
@Pomax Thanks for looking into this! I did see that nodejs rejected a similar issue back in 2012/13: nodejs/node-v0.x-archive#4365 The requester didn't have a compelling reason to add it, however, and it was noted if one existed they'd consider it. @devongovett I'll be sending that tonight when I get home, about 5 or 6 hours from now. |
The |
Update on this, all I had to do was add iconv-lite to the dependencies of my project, and everything's fine. No code change was required. Why is iconv-lite a devDependency for this project, out of curiosity? Seems this works like a charm. |
Because it's kinda large, so we don't want to include it in most cases since most fonts have unicode name tables. |
In 1.5.5, some fonts (specifically Microsoft fonts) do not decode to as string like other fonts. For example:
Script:
Output:
The hex translates to
W i n g d i n g s
, but I see no way of getting to that from a simple.toString(encoding)
call. What can I do to decode this? Further, is there something that fontkit can do to ensure that we get strings back for the family name, even if the font might be encoded strangely?The text was updated successfully, but these errors were encountered: