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

com.google.fonts/test/034: xAvgCharWidth bakery vs glyphs vs font val #1622

Closed
m4rc1e opened this issue Oct 25, 2017 · 7 comments
Closed

com.google.fonts/test/034: xAvgCharWidth bakery vs glyphs vs font val #1622

m4rc1e opened this issue Oct 25, 2017 · 7 comments
Assignees
Labels

Comments

@m4rc1e
Copy link
Collaborator

m4rc1e commented Oct 25, 2017

When running check-google fonts on Barlow we get:

>> com.google.fonts/test/034 with ((u'font[16]', '/Users/marc/Documents/googlefonts/manual_font_cleaning/barlow/fonts/ttf/Barlow-Thin.ttf'),)
   Check if OS/2 xAvgCharWidth is correct.
 * FAIL: OS/2 xAvgCharWidth is 500 but should be 501 which corresponds to the average of all glyph widths in the font

Recently this test has been off by just a unit on the most recent versions of glyphs.

In Ms Val, it is a completely different story:
screen shot 2017-10-25 at 15 27 26

So we have:

Glyphs: 500
FB: 501
Ms Font Val: 420

In the MS Spec:

The value for xAvgCharWidth is calculated by obtaining the arithmetic average of the width of all non-zero width glyphs in the font. Furthermore, it is strongly recommended that implementers do not rely on this value for computing layout for lines of text, especially for cases where complex scripts are used.

https://www.microsoft.com/typography/otspec/os2.htm#acw

Against MS
When I look at the FB implementation, I can't see anything that would lead to such a drastic difference.

Against Glyphs
Perhaps they do floor rounding for this calculation?. We use round which will round higher any float >.5 e.g 4.5 is 5

cc @schriftgestalt

@anthrotype
Copy link
Member

I wouldn't care too much about xAvgCharWidth. See @behdad's fonttools/fonttools#1079 (comment)

We discussed having an MVAR entry for that item but everyone agreed that value is useless...

@davelab6
Copy link
Contributor

Maybe our check can accept values that off by 1-2-5 units?

@m4rc1e
Copy link
Collaborator Author

m4rc1e commented Oct 26, 2017

Could this also be set to a WARN?

@davelab6
Copy link
Contributor

I would prefer the value to be somewhat sensical, since things like getflourish.github.io/anatomy-of-typefaces use it

@anthrotype
Copy link
Member

yeah, WARN sounds good, and allow a tolerance of +/- 1 unit

@felipesanches
Copy link
Collaborator

felipesanches commented Oct 26, 2017

OK. I think I have enough input to come up with a sensible solution for this.

I'm working on this one now.

@HinTak
Copy link

HinTak commented Jul 30, 2018

See HinTak/Font-Validator#33

This was referenced Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants