-
Notifications
You must be signed in to change notification settings - Fork 74
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
Any way to get the glyph name? #47
Comments
what is a glyphs name? |
@photopea See fontkit's glyph object for example: https://github.com/foliojs/fontkit#glyph-objects
Please also see https://stackoverflow.com/questions/23185221/getting-the-glyph-name-from-a-ttf-or-otf-font-file |
I am familiar with the OpenType specification, but I have never heard of glyph names. Could you show us some examples, what glyph should have what names? Also, why would you need a name of a glyph? |
Sure, it's easy to parse the glyphs with a capable library, here's an example with
Output:
Glyph names are used in icon fonts to allow developers use the icons easier. Instead of hexadecimal, developers specify the glyph name: https://fontawesome.com/docs/desktop/add-icons/glyphs I'm trying to parse fonts for glyph names for a little tool I'm working on for myself. I'd like to use Typr.js instead of other fonts, your library seems slimmer. Would you add support for glyph names? |
Ok, I see that there are glyph names in the CFF table. So this is possible only for some OTF files, impossible for TTF files. But each glyph in the FontAwesome has an unicode code, e.g. this https://fontawesome.com/icons/magnifying-glass?f=classic&s=solid has an unicode code 0xf002 , so you can use Typr.U.codeToGlyph(font, 0xf002) |
@photopea Thanks for your reply, but I'm not following you. How does your example
|
I am suggesting to use only unicode codes, do not use the glyph names at all. Refer to glyphs by their unicode codes. |
Oh, but I need the glyph names, that's the whole point :) I need to be able to automatically get the icon (glyph) names out of an icon font. |
Can I use your library to get the glyph's name (if it exists)?
Some fonts have it set I think.
Thanks!
The text was updated successfully, but these errors were encountered: