8000 Extend name table with more general functions by ollimeier · Pull Request #2526 · fonttools/fonttools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

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

Merged
merged 9 commits into from
Feb 9, 2022

Conversation

ollimeier
Copy link
Contributor

extend name table with getFamilyName, getSubFamilyName and getNiceFullName + unittests

Copy link
Member
@anthrotype anthrotype left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@anthrotype
Copy link
Member

you may want to add your name to the list of contributors in the README, as first-time contributor (at least according to Github)

@ollimeier
Copy link
Contributor Author

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.

@anthrotype anthrotype merged commit 8a139f9 into fonttools:main Feb 9, 2022
# 4 = Full Name
# 6 = PostScript Name
for nameIDs in ((21, 22), (16, 17), (1, 2), (4, ), (6, )):
8000 if len(nameIDs) == 2:
Copy link

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?

Copy link
Contributor Author

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, ).

Copy link
@moi15moi moi15moi May 9, 2022

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))

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))

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0