-
Notifications
You must be signed in to change notification settings - Fork 294
Resolve several major issues: Vertical Metrics, Monospace Recognition #227
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
Conversation
- Display string can be heavy process while opening the .glyphs file - lastChange possibly adding new unnecessary record history, such as last saved file or hit cmd + s
Prepare tweaking vertical metrics value Please refer to this opentype guideline: - https://learn.microsoft.com/en-us/typography/opentype/spec/os2#fsselection - https://googlefonts.github.io/gf-guide/metrics.html#5-use_typo_metrics-must-be-enabled
Highest & Lowest glyphs on each file: - Monaspace Xenon Var.glyphs — Uring (2011.0), Gcommaaccent (-786.0) - Monaspace Xenon.glyph — Uring (2011.0), Gcommaaccent (-786.0) - Monaspace Argon Var.glyph — lacute (1988.0), Gcommaaccent (-786.0) - Monaspace Argon.glyph — lacute (1988.0), Gcommaaccent (-786.0) - Monaspace Krypton Var.glyph — lacute (1988.0), Gcommaaccent (-786.0) - Monaspace Krypton.glyph — lacute (1988.0), Gcommaaccent (-786.0) - Monaspace Neon Var.glyph — lacute (1988.0), Gcommaaccent (-786.0) - Monaspace Neon.glyph — lacute (1988.0), Gcommaaccent (-786.0) Please refer to these documentation: - winAscent: https://learn.microsoft.com/en-us/typography/opentype/spec/os2#uswinascent - winDescent: https://learn.microsoft.com/en-us/typography/opentype/spec/os2#uswindescent - https://googlefonts.github.io/gf-guide/metrics.html#6-winascent-and-windescent-values-must-be-the-same-as-the-familys-tallestdeepest-ymin-and-ymax-bounding-box-values
- githubnext#21 githubnext#37 "Hanging Font": Miss configure `typo` and `hhea` value. Adjust this value will "centering" glyphs across the vertical bounding box. - githubnext#169 Probably same as above, tweaking `typo` and `hhea` does resolve the `line-height` or `leading` default to `1.2` or `120%` from the upm value. UPM = 2000 (typo/hhea)Ascenders = 1930 (typo/hhea)Descenders = -470 (typo/hhea)LineGap = 0 Total: ascender + abs(descenders) + linegap = 2400 Note that "Gcommaaccent" may be truncated in environments that have `overflow: hidden` Please see these documentation: - https://googlefonts.github.io/gf-guide/metrics.html#6-winascent-and-windescent-values-must-be-the-same-as-the-familys-tallestdeepest-ymin-and-ymax-bounding-box-values - https://googlefonts.github.io/gf-guide/metrics.html#11-the-sum-of-the-fonts-vertical-metric-values-absolute-should-be-20-30-greater-than-the-fonts-upm
Because `isFixedPitch` is not set, the record in the POST Table `isFixedPitch` has zero value. Please refer to these: - https://learn.microsoft.com/en-us/typography/opentype/spec/post#header - https://googlefonts.github.io/gf-guide/requirements.html#monospace-fonts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be automatically set if it would be valid iirc.
Forcing the value to 1 while the font is not isFixedPitch can lead to problems, see for example google/fonts#225
Anyhow, the root cause should be in
and supposedly it is fixed now. But it is not. I can redo the search for offending glyphs if need be.
Here the isFixedPitch value in the font file:
fini@Air ~ % showttf ~/Downloads/monaspace-v1.101/fonts/otf/MonaspaceArgon-Regular.otf | tail -n +1065 | head
Required tables: glyf and loca have been replaced by CFF => OpenType
post table (at 7312)
format=00030000
italicAngle=0
underlinePos=-70
underlineWidth=72
fixedpitch=0
mem1=0
mem2=0
mem3=0
mem4=0
fini@Air ~ %
Here a screenshot of the "warning" to set it in Glyphs ;-)
Screenshot 2024年06月07日 at 17 13 21Comment on commit 972eb52 Check Use Typo Metrics to get more consistent vertical metrics
More important would be to just make all 3 metrices the same (already the case), and avoid using gap values.
Hmm, and then the released font does already have that set, see here:
fini@Air ~ % font-line report ~/Downloads/monaspace-v1.101/fonts/otf/MonaspaceArgon-Regular.otf
=== /Users/fini/Downloads/monaspace-v1.101/fonts/otf/MonaspaceArgon-Regular.otf ===
Version 1.101 (Monaspace Argon)
SHA1: 02edd009f5cf7e196e311e7167dbf62b6fac3806
::::::::::::::::::::::::::::::::::::::::::::::::::
Metrics
::::::::::::::::::::::::::::::::::::::::::::::::::
[head] Units per Em: 2000
[head] yMax: 1951
[head] yMin: -760
[OS/2] CapHeight: 1460
[OS/2] xHeight: 1027
[OS/2] TypoAscender: 1565
[OS/2] TypoDescender: -435
[OS/2] WinAscent: 1878
[OS/2] WinDescent: 522
[hhea] Ascent: 1565
[hhea] Descent: -435
[hhea] LineGap: 400
[OS/2] TypoLineGap: 400
::::::::::::::::::::::::::::::::::::::::::::::::::
Ascent to Descent Calculations
::::::::::::::::::::::::::::::::::::::::::::::::::
[hhea] Ascent to Descent: 2000
[OS/2] TypoAscender to TypoDescender: 2000
[OS/2] WinAscent to WinDescent: 2400
::::::::::::::::::::::::::::::::::::::::::::::::::
Delta Values
::::::::::::::::::::::::::::::::::::::::::::::::::
[hhea] Ascent to [OS/2] TypoAscender: 0
[hhea] Descent to [OS/2] TypoDescender: 0
[OS/2] WinAscent to [OS/2] TypoAscender: 313
[OS/2] WinDescent to [OS/2] TypoDescender: 87
::::::::::::::::::::::::::::::::::::::::::::::::::
Baseline to Baseline Distances
::::::::::::::::::::::::::::::::::::::::::::::::::
hhea metrics: 2400
typo metrics: 2400
win metrics: 2400
[OS/2] fsSelection USE_TYPO_METRICS bit set: True
::::::::::::::::::::::::::::::::::::::::::::::::::
Ratios
::::::::::::::::::::::::::::::::::::::::::::::::::
hhea metrics / UPM: 1.2
typo metrics / UPM: 1.2
win metrics / UPM: 1.2
fini@Air ~ %
It appears to be identical, but it is not. See the differences below.The released version (old files: before-argon-bold However, the above metrics caused
Reference: https://googlefonts.github.io/gf-guide/metrics.html#9-uppercases-should-be-centered-in-the-text-line The tweaked version (this PR: after-argon-bold Even though I changed the
Reference: https://googlefonts.github.io/gf-guide/metrics.html#8-linegap-values-must-be-0 |
Well, the matrices were all the same, at least the baseline to baseline distance. 🤷♀️
More important would be to just make all 3 metrices the same (already the case), and avoid using gap values.
That's what you did, and what I said one should do. Set gaps to zero, they are a headache for fonts that are intended for terminals anyhow.
If the matrices are the same they will be rendered the same and "use typo metrics" (which is useless anyhow, as you know if you read all the documentation) is superfluous. The problem is that some terminals ignore GAP, some put it half top and bottom, some on the bottom, some on the top. That also affects this "not vertically centered"; the problem depends on the terminal used and how it interprets (if at all) the GAP.
Just setting the use-typo-metrics usually does not change anything, as the typo values ought to be used in any case ;-)
Google fonts has some "suggestions" that one can follow or not, like this one
Screenshot 2024年06月07日 at 23 46 24If you think Google is God, of course one needs to follow.
And why do you link this, as like, it contradicts what I said, when it is exactly my point?
Screenshot 2024年06月07日 at 23 46 40I don't get it.
Ciao.
Have you tried the .ttf files? And don't you see the difference?
Old MonaspaceArgonVarVF[wght,wdth,slnt].ttf
iTerm2
Screenshot 2024年06月08日 at 9 10 17 PMMacOS Terminal
Screenshot 2024年06月08日 at 9 11 21 PM
New MonaspaceKryptonVarVF.ttf exported from GlyphsApp (not in this PR)
iTerm2
Screenshot 2024年06月08日 at 9 10 44 PMMacOS Terminal
Screenshot 2024年06月08日 at 9 12 02 PM
Or from default HTML Button component
Google Chrome (Version 125.0.6422.142)
Screenshot 2024年06月08日 at 10 06 53 PMSafari (Version 17.4.1)
Screenshot 2024年06月08日 at 10 08 50 PMFirefox (Version 122.0.1)
Screenshot 2024年06月08日 at 10 09 23 PMOpera (Version: 109.0.5097.68)
Screenshot 2024年06月08日 at 10 09 59 PM
This PR only tweaks all
vertical metricsandfont infoon each.glyphsfile1. Avoid write lastChange and displayString to version control
2. Check
Use Typo Metricsto get more consistent vertical metrics- https://learn.microsoft.com/en-us/typography/opentype/spec/os2#fsselection
- https://googlefonts.github.io/gf-guide/metrics.html#5-use_typo_metrics-must-be-enabled
3. Resolve #21 #37 #169
- #21 #37 "Hanging Font": Miss configure
typoandhheavalue. Adjust this value will "centering" glyphs across the vertical bounding box.- #169 Probably same as above, tweaking
typoandhheadoes resolve theline-heightorleadingdefault to1.2or120%from the upm value.Note that "Gcommaaccent" may be truncated in environments that have
overflow: hidden.Please see these documentation:
- https://googlefonts.github.io/gf-guide/metrics.html#6-winascent-and-windescent-values-must-be-the-same-as-the-familys-tallestdeepest-ymin-and-ymax-bounding-box-values
- https://googlefonts.github.io/gf-guide/metrics.html#11-the-sum-of-the-fonts-vertical-metric-values-absolute-should-be-20-30-greater-than-the-fonts-upm
4. Resolve #111 not recognized as monospace font
Because
isFixedPitchis not set, the record in the POST TableisFixedPitchhas zero value.Please refer to these:
- https://learn.microsoft.com/en-us/typography/opentype/spec/post#header
- https://googlefonts.github.io/gf-guide/requirements.html#monospace-fonts
These images below illustrate
Aringon theoverflow: hiddenenvironmentBefore: Top of Aring seems clipping because miss configuration
typo/hheabefore-argon-bold
After: Resolve clipping and vertically balance basic latin
after-argon-bold