-
Notifications
You must be signed in to change notification settings - Fork 475
Extend name table with more general functions #2526
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
Extend name table with more general functions #2526
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM!
you may want to add your name to the list of contributors in the README, as first-time contributor (at least according to Github) |
Looks like it needs another approval because I added my name. |
# 4 = Full Name | ||
# 6 = PostScript Name | ||
for nameIDs in ((21, 22), (16, 17), (1, 2), (4, ), (6, )): | ||
8000 if len(nameIDs) == 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you check if the lenght of nameIDs is 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @moi15moi , thanks for asking. The reason behind is, because the loop starts with the preferred name table ID pairs (21, 22), (16, 17), (1, 2). And if none of them are present (which might be the case in obfuscated web font) then use only the (4, ), (6, ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks.
I am trying to understand why getBestFullName, getBestFamilyName and getBestSubFamilyName does not always return me the good name.
I did some commit to make to get the right name, but I am not too sure if I am allow to use: utf-16-be
https://github.com/moi15moi/fonttools
Edit: Here is how FontConfig get the right name: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/blob/main/src/fcfreetype.c#L693
I don't know a lot of c, but from what I can see, that's should be the if we should try to replicate: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/blob/main/src/fcfreetype.c#L715
# 22 = WWS SubFamily Name | ||
# 17 = Typographic SubFamily Name | ||
# 2 = SubFamily Name | ||
return self.getFirstDebugName((22, 17, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should always priorise the record 22 and 17.
There should be a parameter. For example, in my case, I would like to get the "real" SubFamily Name.
# 21 = WWS Family Name | ||
# 16 = Typographic Family Name | ||
# 1 = Family Name | ||
return self.getFirstDebugName((21, 16, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should always priorise the record 21 and 16.
There should be a parameter to specify what we want prioritized. For example, in my case, I would like to get the "real" Family Name.
extend name table with getFamilyName, getSubFamilyName and getNiceFullName + unittests