Skip to content
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

Add fix_glyph_names() #446

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

simoncozens
Copy link
Contributor

This adds a fix for the fontbakery glyph naming check; it uses ufo2ft's logic to rename glyphs to production names. This is useful because in a variable-first workflow, you build the variable font first and then add GSUB/GPOS/GDEF tables to it from a variable feature file afterwards. To do this, the glyph names in the font have to be the same as the ones in the feature file, and hence you have to pass --no-production-names to fontmake, and then do the renaming afterwards. (You could use Rust's ttf-rename-glyphs but that's not part of our workflow yet. ;-)

Because this is a slightly obscure use case, I've not added it to fix_font.

@simoncozens simoncozens marked this pull request as draft December 2, 2021 17:50
@simoncozens
Copy link
Contributor Author

This is clever but doesn't work. If you decompile the cmap table (as we did to find the existing Unicode mappings), the mappings are stored internally in the font object as codepoint => glyph names. Changing the glyph names in the TTFont object doesn't change the names in the cmap table objects.

(Incidentally this is why fonttools-rs uses glyph IDs rather than glyph names everywhere.)

@m4rc1e
Copy link
Collaborator

m4rc1e commented Dec 3, 2021

I'm probably being dense here but I thought all our VFs already have production names? do you need this because you have a custom build pipeline that only uses a few pieces of fontmake?

@simoncozens
Copy link
Contributor Author

Yeah, basically. I've put it into a custom script in my font's repo, but I figured if this is something that fontbakery has a check for, it should also be something that gftools should have a fix for...

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.

2 participants