Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Support unit suffixes #174

Closed
rsheeter opened this issue Jun 29, 2023 · 3 comments
Closed

Support unit suffixes #174

rsheeter opened this issue Jun 29, 2023 · 3 comments

Comments

@rsheeter
Copy link
Collaborator

We should be getting fea unit suffixes. I would like to use these in fontc. I particularly want normalized as it is the most natural way for me to emit kerning value records. googlefonts/fontc#345 WIP emits things like and will probably block on this capability:

feature kern {
  pos dze-cy Te-cy (wght=-1n:-69 wght=0n:-61 wght=1n:-49);
  ...etc...

""u" for user units, which as I said would be the default if omitted. Design units would be "d" and normalized units would be "n"

harfbuzz/boring-expansion-spec#94 (comment).

@cmyr
Copy link
Owner

cmyr commented Aug 15, 2023

Some additional thoughts on this:

  • suffixes are only valid when parsing metrics, not other numerical values
  • are suffixes valid in non-variable fonts? we don't know if we have variation info during parsing, so this will be a question for the validation pass
  • this also implies/requires that metrics can be non-integer ('float'/real) values. Do we accept user coordinates as non-integers, or does the presence of a non-integer metric require a suffix?

as a first pass I would say:

  • just allow reals in all cases
  • truncate in resolution where required
  • error in validation if we see design or normalized units and don't have a variation model

@rsheeter one thought just occurred to me, which I don't have enough context to answer: will this actually simplify fontc? As far as I understand, the simplification here is that when fontc has normalized units it won't be required to convert these to user coordinates. But it will still need to provide the logic to normalize existing user coordinates, and will now have to support normalizing design coordinates as well. Is this a win?

  • fontc will still need to be able to handle normalizing user coordinates
  • but fontc will also now need to be able to normalize design coordinates as well

@rsheeter
Copy link
Collaborator Author

fontc benefits in two ways:

  1. Generating fea with normalized units is more natural because that's what we have so we don't have to convert to user
  2. We dont' have to convert the user units that we produced from normalized units back to normalized units again via callback so a bit less work is actually done iiuc

@cmyr
Copy link
Owner

cmyr commented Aug 22, 2023

added in #203

@cmyr cmyr closed this as completed Aug 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants