canonical / Ubuntu-Sans-fonts

Other
54 stars 4 forks source link

Vertical metrics regression #14

Closed guidoferreyra closed 1 year ago

guidoferreyra commented 2 years ago

Fonts currently distributed via Google Fonts doesn‘t comply with GF’s "new" vertical metrics scheme.

For the new fonts it will be needed to make a decision regarding this subject. Some of the possible options:

a. Change vertical metrics to the new scheme which will break backwards compatibilty b. Not updating metrics will maitain the compatibilty but may not be allowed by GF c. Update the metrics following GF’s guide

GF version Metrics

Font capHeight xHeight typoAscender typoDescender typoLineGap winAscent winDescent hheaAscent hheaDescent hheaLineGap useTypoMetrics
Ubuntu-Light 693 517 776 -185 56 932 189 932 -189 28 false
Ubuntu-LightItalic 693 517 776 -185 56 932 189 932 -189 28 false
Ubuntu-Regular 693 520 776 -185 56 932 189 932 -189 28 false
Ubuntu-Italic 693 520 776 -185 56 932 189 932 -189 28 false
Ubuntu-Medium 693 523 776 -185 56 932 189 932 -189 28 false
Ubuntu-MediumItalic 693 523 776 -185 56 932 189 932 -189 28 false
Ubuntu-Bold 693 526 776 -185 56 932 189 932 -189 28 false
Ubuntu-BoldItalic 693 526 776 -185 56 932 189 932 -189 28 false

Failing FontBakery checks

OS/2.fsSelection bit 7 (USE_TYPO_METRICS) is set in all fonts. 🔥 All fonts

Checking OS/2 Metrics match hhea Metrics. 🔥 All fonts

Check ID: <FontBakeryCheck:com.google.fonts/check/family/win_ascent_and_descent> 🔥 All fonts

Check ID: <FontBakeryCheck:com.google.fonts/check/linegaps> ⚠️ All fonts

lyubomir-popov commented 2 years ago

@guidoferreyra what is the difference between options a) and c) ?

guidoferreyra commented 2 years ago

Apologies @lyubomir-popov somehow I overlooked your comment. For Ubuntu fonts, with the method described in the link from item "c)" the new typoMetrics will match old winMetrics to keep compatibility. In the other hand, method a) or "starting with a clean slate" typoMetrics values are set to a designed and desired measures close to the height of accented letters.

Unless this release is treated as "breaking" and there is no need to keep compatibilty I think the safest is to proceed with the "c)" approach:

    typoAscender = Old WinAscent
    typoDescender = Old negative WinDescent
    typoLineGap = 0
    hheaAscender = typoAscender
    Hhea Descender = typoDescender
    hheaLineGap = typoLineGap
    winAscent = bbox yMax
    winDescent = bbox yMin (positive)

cc @djrrb

lyubomir-popov commented 1 year ago

Hi @guidoferreyra & @djrrb, we've asked our technical colleagues to look into this. May I ask - what types of breaking changers should we be watching out for? Could you give us an example? Would it be vertical displacement, vertical scaling, or something else?

guidoferreyra commented 1 year ago

Hi @lyubomir-popov

On the Mac, Browsers will use the hhea values. Firefox will use typoMetrics if useTypoMetrics is set. On Windows, all browsers use the usWin metrics, but respect the useTypoMetrics setting and if set will use the Typo values.

Win values needs to be set to the family bbox max and min to prevent clipping. The current setup is not respecting that.

imagen

Avoiding the use of Win values will give a better framework for future updates. For instance, when adding vietnamese characters the win values will need to change a lot.

My proposal is:

So by making hhea and typo metrics the same and setting useTypoMetrics the rendering will be consistent across platforms. The breaking change could be a vertical displacement, but small.

djrrb commented 1 year ago

The vertical metrics Guido recommended above are now set in v0.862, so you can experience what the change will be. They can easily be un-set should any issues arise.

djrrb commented 1 year ago

Lyubo says new metrics sounds like the right call...will reopen if any issues