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

caretSlopeRise for VF masters having different italicAngle is weird #804

Closed
anthrotype opened this issue Dec 7, 2023 · 1 comment · Fixed by #805
Closed

caretSlopeRise for VF masters having different italicAngle is weird #804

anthrotype opened this issue Dec 7, 2023 · 1 comment · Fixed by #805

Comments

@anthrotype
Copy link
Member

when UFO fontinfo does not contain a openTypeHheaCaretSlopeRise and openTypeHheaCaretSlopeRun, ufo2ft falls back to using the italicAngle to define the caret rise/run

It defaults to hhea.caretSlopeRise = 1 and caretSlopeRun = 0 for upright fonts (italicAngle=0) or sets caret rise to a fixed value of 1000 and the caret run is computed from the tangent of the italicAngle, like so:

https://github.com/googlefonts/ufo2ft/blob/a421acc85e55d8ef97f8d99df90ebba63d47fa8f/Lib/ufo2ft/fontInfoData.py#L133C5-L163

(Note that Glyphs.app does not let one override the caret slope run/rise, there are no custom parameters specific to those, so one can only set the masters' italic angle metric, which determines the caret slope).

Now, if a variable font has masters with different italic angles, some of the upright masters will end up with slope (1 / 0), whereas those with italicAngle!=0 with (1000 / slope_run(italic_angle)).

In theory only the slope run could vary, from 0 to something else, whereas the slope rise could stay fixed at 1000, instead of jumping from 1 (for the upright ones) to 1000 for the oblique ones.

This has the effect of producing a needless 'hcrs' (horizontal caret slope rise) MVAR tag with accompanying deltas e.g. <Item index="3" value="[999, 999, 999]"/>

So, to avoid this, should we instead always use 1000 for the upright caret slope rise, instead of 1?

It doesn't actually change the result since the caret slope is a ratio (as https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6hhea.html explains).

Alternatively I could change varLib to detect this situation and when it sees master hhea tables with similar pattern, normalize them to the same slope rise before computing the deltas for the slope run only?... it feels like a hack

@behdad
Copy link
Collaborator

behdad commented Dec 7, 2023

So, to avoid this, should we instead always use 1000 for the upright caret slope rise, instead of 1?

I suggest using UPEM.

anthrotype added a commit that referenced this issue Dec 7, 2023
... so that if masters have different italicAngles only their slope run is allowed to vary, whereas the rise stays fixed

Fixes #804

This will produce a lot of diff noise for nothing downstream, but I think it's for good
anthrotype added a commit to googlefonts/fontc that referenced this issue Dec 7, 2023
I just made a similar change in ufo2ft, see googlefonts/ufo2ft#804
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 a pull request may close this issue.

2 participants