stipub / stixfonts

OpenType Unicode fonts for Scientific, Technical, and Mathematical texts
SIL Open Font License 1.1
728 stars 41 forks source link

The hhea ascent/descent should match the OS/2 sTypo* metrics #53

Closed davidmjones closed 6 years ago

davidmjones commented 10 years ago

Open

http://www.maths-informatique-jeux.com/ulule/mathml_torture_test/ascent-descent.html

in a Gecko or WebKit browser. Some fonts (including STIX Math) have excessive accent/descent while others render correctly (XITS Math, Neo Euler, Asana Math). Here is a screenshot:

https://bug947650.bugzilla.mozilla.org/attachment.cgi?id=8344238

It seems that these browsers prefer the incorrect hhea ascent/descent to the OS/2 sTypo* metrics. I've reported this issue to browsers, but the hhea metrics should be fixed in STIX Math to match the typo metrics and avoid this bug.

Browser bugs: https://bugzilla.mozilla.org/show_bug.cgi?id=947650 https://bugs.webkit.org/show_bug.cgi?id=131839

Reported by: fred-wang

Original Ticket: stixfonts/tracking/53

davidmjones commented 10 years ago

A workaround has been added in Gecko 31 for Linux/Mac, but the problem still persists on Windows and on WebKit. This bug is the most serious issue I reported and prevents the use of STIX Word in browsers. Please increase the priority and consider fixing it for the next release. This is trivial to do, even with the least tech knowledge.

Here is a small Python script to fix the metrics automatically (run it in the directory containing the STIX Word fonts):

==== fix-issue-53.py ====

import fontforge

STIXWord = [ "STIX-Regular.otf", "STIX-Bold.otf", "STIX-Italic.otf", "STIX-BoldItalic.otf", "STIXMath-Regular.otf" ]

for filename in STIXWord: font = fontforge.open(filename) font.hhea_ascent = font.os2_typoascent font.hhea_descent = font.os2_typodescent font.generate(filename)

=========================

Alternatively, you can fix it by hand: open each font in fontforge, do Element => Infos font => OS/2 => Metrics and modify the hhead ascent/descent to match the (typo) ascent/descent.

If none of this works, please contact me so that I can do the modification for you.

Original comment by: fred-wang

davidmjones commented 10 years ago

If you want consistent behavior across browsers, then the font developers must set: typo == hhea == win and typo.linegap == hhea.linegap == 0

Original comment by: tphinney

davidmjones commented 10 years ago

This issue is being reviewed as part of a comprehensive analysis of the STIX fonts for the version 2.0.0 development.

Original comment by: stipub

davidmjones commented 10 years ago

FYI, here is another script used for the MathML-fonts add-on, which follows Thomas' suggestion: https://github.com/fred-wang/Mathzilla/blob/master/mathml-fonts/fix-ascent-descent.py

Original comment by: fred-wang

davidmjones commented 10 years ago

The OpenType MATH support is now mentioned on the official Firefox beta release notes (to be released end of July):

https://www.mozilla.org/en-US/firefox/31.0beta/releasenotes/

and points to a page mentioning this bug for Windows.

Original comment by: fred-wang

davidmjones commented 10 years ago

Here is an article providing a good summary: http://typophile.com/node/13081

Original comment by: fred-wang

davidmjones commented 9 years ago

So I think making hhea metrics match OS/2 sTypo* metrics is more or less optional, now. It won't fix the bug due to large Win ascent/descent, anyway.

The real issue is that USE_TYPO_METRICS is not set: https://sourceforge.net/p/stixfonts/tracking/64/

Original comment by: fred-wang

davidmjones commented 7 years ago

I believe this issue can be closed with the STIX2 release.

Original comment by: fred-wang

davidmjones commented 7 years ago

Original comment by: stipub

davidmjones commented 7 years ago

Thank you. Many of the other open tickets we expect have been resolved. They will be closed once that is confirmed otherwise left open for consideration in the next release

Original comment by: stipub

davidmjones commented 7 years ago

Original comment by: stipub