[webkit-dev] Fonts for WebKit tests on OS X?

Myles C. Maxfield mmaxfield at apple.com
Fri Mar 11 13:12:44 PST 2016

Replies inline.
> On Mar 11, 2016, at 6:30 AM, Frédéric WANG <fred.wang at free.fr> wrote:
> *TL;DR: Can you please indicate how to add fonts to use for WebKit tests
> on OS X? This is is needed for existing and future MathML tests (and
> actually pre-installing them on Mac/iOS would improve user experience).*
> Dear all,
> In the context of the MathML refactoring [1], I've recently been
> reviewing test results on OS X. Unfortunately, many of existing tests or
> tests that will be added by the current set of MathML refactoring
> patches require a math font with an OpenType MATH table to work
> properly. This is not the case of the obsolete STIXGeneral font families
> that have been installed by default since OS X Lion [2]. Hence for now
> those tests are just skipped or have incorrect text/PNG expectations. As
> a comparison, the GTK port uses the Latin Modern Math font to ensure
> consistent results [3].
> I'm attaching a simple test-fonts.html page and I'm providing the
> screenshots obtained when I use run-safari or run-webkit-tests with a
> WebKit build integrating the MathML refactoring patches. From this
> experiment, it seems that run-webkit-tests only use the pre-installed
> system fonts (STIXGeneral) but not the fonts I installed manually on my
> Mac. However, the latter are correctly selected with run-safari and then
> you can see that the rendering of math equations is much better and
> closer to the TeX references from the MathML torture test [4].
> So my question: is there a way to ensure that WebKit tests are executed
> with specific fonts on OS X without polluting the WebKit repo with big
> math Web fonts?

Just to clarify: you want tests to use some specific fonts, but don’t want to check the fonts into the repository?

I can only think of two ways to do this:
1. Require anyone who wants to run layout tests to install a handful of fonts. Ask the user to download them from a known place. This is currently how the Apple Windows port works.
2. Petition for the fonts to be preinstalled on all future releases of OS X, and mark the tests as expected to fail on all current versions of OS X.

Both of these options have huge downsides. The downside to 1 is that it adds a new (non-obvious) step that all developers will have to perform every time they install a new operating system (in addition to any time we bring up a new buildbot). I would object to making the development environment even more complicated than it already is.

I’m not sure if I’m allowed to publicly discuss my opinions about 2 (since it is technically an internal matter) but I would expect its success to be dubious.

Given this, I think the best solution is to check the fonts into the repository. Layout tests could target these as web fonts using @font-face, or they could use the same mechanism that we use for WebKitWeightWatcher (which is a font) to view the font as if it is preinstalled (without actually preinstalling it).

> If the solution is to have these math fonts pre-installed on OS X, then
> that would also be great to enhance Safari user experience, as shown by
> the attached screenshots. In that case, this is probably not the
> business of WebKit developers but I'd like to suggest two math fonts
> (also reported to Apple some years ago as problems number 16841023 and
> 17021145):
> 1) STIX Math [5], which has very good coverage for unicode symbols, is
> supported by some tech companies, is released under SIL OFL and is the
> next version of the STIXGeneral font families currently pre-installed on
> OS X. Unfortunately the current 1.1 release has too many bugs and so is
> not really usable for math layout, but version 2 will solve them and is
> claimed to be released "soon".
> 2) Latin Modern Math [6], which has the Computer Modern style used by
> default by TeX rendering engines and is used for WebKitGTK+ tests. This
> font uses the LaTeX Project Public License + a Reserved Font Name clause
> but the authors expressed their will to release it under SIL OFL, if
> that can help.
> Thank you,
> Frédéric
> [1] https://lists.webkit.org/pipermail/webkit-dev/2015-December/027840.html
> [2] https://bugs.webkit.org/show_bug.cgi?id=41961
> [3] https://github.com/mrobinson/webkitgtk-test-fonts
> [4]
> https://developer.mozilla.org/en-US/docs/Mozilla_MathML_Project/MathML_Torture_Test
> [5] http://stixfonts.org/
> [6] http://www.gust.org.pl/projects/e-foundry/lm-math
> <screenshot-run-safari.png><screenshot-run-webkit-tests.png><test-fonts.html>_______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

More information about the webkit-dev mailing list