-
Notifications
You must be signed in to change notification settings - Fork 682
Name table #1254
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
Name table #1254
Conversation
8eb4f4b to
bbe1ae8
Compare
|
I fleshed most of this out. What's left is 1. language handling and 2. encoding handling. The UTF conversion routines can use some review. @jfkthame Thanks in advance! |
It assumes all names are encoded in UTF16-BE. Other than that, and not listing languages correctly, it's *supposed* to work.
Accept Mac Latin name entries as ASCII as well.
|
I'm done with the implementation. FULLY untested though... Going to write a tool to list names in a font... |
We already have API that returns nameIDs using "hb_name_id_t *out". So, this is not the safest change. But that API is also unused by everyone right now. We already define hb_script_t as an enum where we expect non-enumerated values to be used as well. That's legitimate in C. Not sure about C++. nameIDs are slightly different in that non-enumerated ones are more common? |
|
I think I like to rename |
|
Maybe we don't care about subtags. It's not clear what the desired behavior is... Is good if we add subtags that distinguish script. But for regions, say, if user asks for fa-af and there's only fa available we should return it. |
This is similar to what we do for ot-tags already. Do we need a couple functions for match-level of two language tags? Or just implement internally here? |
|
If HarfBuzz really wants to do language matching (“language subtag handling”), have a look at the Go implementation which is quite cleanly written, and works on small data tables. See blog post and source code. ICU has an implementation too, which is more involved than Go. But my personal recommendation would be to stay away from this; it seems to go beyond the scope of HarfBuzz, and getting it correct is not trivial. |
|
Regarding |
It doesn't. This is where it should be handled: https://github.com/harfbuzz/harfbuzz/pull/1254/files#diff-fc989e6dfa921e399954f43b75b091c0R68 |
It doesn't. This is where it should be handled: https://github.com/harfbuzz/harfbuzz/pull/1254/files#diff-fc989e6dfa921e399954f43b75b091c0R68
Thanks for the links. Okay, I'm convinced we don't want to be in this business. I know Akira TAGOH wrote a library for this, can't find it right now. |
|
Hm, the |
Yeah that looks different. |
|
Just checked the system fonts on macOS 10.14. They contain the following language tags in |
|
O think treating null language as “en” makes sense as the English not the localized names is what most applications want by default so makes the common case slightly simpler. |
|
We can make |
Agreed. Done. Also need docs for new API and hooking them up in the docs. |
Right. Any idea what to do with newlines in the name? |
|
I merged this manually. The cmdline tool can come later. |
|
I was going to make a release, but had to make some last minute changes to this. And ended up making |
|
One last question before this goes into a release. Should I rename |
|
Is there anything OT specific about the name ids (not sure I fully grasp the OT/non-OT split in the API naming). |
Do those name-id numbers make sense for Type1, BDF, PCF, ...? No. |
|
Right, in my mind non-OT meant AAT/Graphite etc. I have no strong opinion either way, but probably |
We refer to GSUB/GPOS as ot-layout. To the script logic as ot-shape. Use OT as a encompassing of OpenType and extensions... |
|
Agree that hb_ot_name.... seems appropriate. |
Work in progress.
Fixes #432