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

Fix unknown axis #4

Merged
merged 6 commits into from
Nov 16, 2023
Merged

Fix unknown axis #4

merged 6 commits into from
Nov 16, 2023

Conversation

justvanrossum
Copy link
Collaborator

  • Add MutatorSans.fontra as test font
  • Parametrize testing
  • Fix bug when a non-existing axis is referenced

@justvanrossum justvanrossum merged commit 8b14dbc into main Nov 16, 2023
4 checks passed
@justvanrossum justvanrossum deleted the fix-unknown-axis branch November 16, 2023 11:03
@@ -0,0 +1,54 @@
glyph name;code points
A;0041,0061
Copy link
Member

@anthrotype anthrotype Nov 16, 2023

Choose a reason for hiding this comment

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

sorry if I hijiack this, I got curious about the .fontra source file which I see for the first time, and noticed this glyph-info.csv.
Two questions:

  1. if it's a .csv, should it not only use one separator, either ; or ,? Here I see both used. Maybe that's fine but it means one has to parse things twice instead of in one go, or need to use a special parser instead of off-the-shelf csv parser
  2. I was also reminded about [UFO4] Separating unicode from glif unified-font-object/ufo-spec#77, I thought we were leaning towards having {unicode: glyphName} map for codepoints instead of {glyphName: [unicodes]}, to better represent what cmap does and avoid potential double-mappings. I'm curious why you ended up the way you did for fonta source format.

Copy link
Collaborator Author

@justvanrossum justvanrossum Nov 16, 2023

Choose a reason for hiding this comment

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

  1. The separator is ;, and I used , to separate multiple unicodes in a single cell. (I will probably add U+ for each code point, though.)
  2. I'm still a bit torn about that, however, there's also Longer term idea: add a .csv file for glyph info unified-font-object/ufo-spec#163, which this could be a starting point for. I think that's a very valuable idea, and allows us to add arbitrary columns for additional glyph information.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Btw. here is the implementation for the .fontra format: https://github.com/googlefonts/fontra/blob/main/src/fontra/backends/fontra.py

Copy link
Member

Choose a reason for hiding this comment

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

I see, thanks. They way I see it, unicode codepoints are not a glyph property at all, it's the other way around, so they are kind of special in this regard and maybe should be stored in their own cmap.txt or cmap.csv as a mapping from unicode to glyph name. Anyway, these are just my 2 cents.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unicode codepoints are not a glyph property at all

I agree with you in principle, but having both a glyph-keyed table, and a code point-keyed table seems a bit contradictory (or redundant) as well.

I originally wanted to implement the "pure cmap" concept for Fontra. The first thing the client wants to know is "which glyphs exist", and "what is the cmap". For large (CJK) fonts this can be a bottle neck on page-startup, so I decided to combine two into one, which I called the "glyph map", which is essentially what glyph-info.csv is.

(I could still have a pure cmap in the format, and use the reverse for wire communication. But then I remembered the glyph spreadsheet idea, which is something that I have high hopes for.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also btw. Fontra has an entry point called fontra-copy, which can be used to convert any format it can read to any format it can write (the latter only .designspace/.ufo and .fontra). For example:

fontra-copy myfont.designspace myfont.fontra
fontra-copy myfont.glyphs myfont.fontra
fontra-copy myfont.glyphs myfont.designspace
fontra-copy myfont.ttf myfont.fontra

Very much limited to the subset of font data that Fontra currently understands, which isn't much besides glyph data.

Copy link
Member

Choose a reason for hiding this comment

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

good to know thanks!

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