MathML should be looking at font features (for instance those found in OpenType) to determine replacements for stretching characters and to better position equation components
I see that there are some stuff in platform/graphics/opentype/, but I don't know for what it is used for and on which platforms it is available. Some updates on this: - Since that was needed for Gecko, I've added support for the MATH table in OTS: https://codereview.chromium.org/139563002/ - Microsoft's MATH table is not yet public but has been submitted to the MPEG group in response to the 'Call for Proposals for ISO/IEC 14496-22 "Open Font Format" Color Font Technology and MATH layout support' (http://mpeg.chiariglione.org/standards/mpeg-4/open-font-format/call-proposals-isoiec-14496-22-open-font-format-color-font)
I've done more testing on the MATH table yesterday. So my understanding is that: - OTS is no longer used in WebKit (bug 68292), so the MATH support I added to OTS is not relevant here. - The stuff in platform/graphics/opentype/ is only specific to EFL and GTK platforms at the moment, so we'll have to think about what to do for other platforms. For now, I think I'll follow https://www.webkit.org/coding/adding-features.html and add a new experimental feature OPENTYPE_MATH. So far I've just try to connect the MathML code to the OpenType code. I have a patch to read the default linethickness of a fraction from the MATH table and to use it in the MathML rendering code. That seems to work with local and WOFF fonts. I plan to submit a patch later.
Created attachment 224216 [details] WIP Patch So here is a proof-of-concept patch that reads the fraction linethickness from the MATH table in GTK/EFL. If you visit http://www.maths-informatique-jeux.com/ulule/mathml_torture_test/fraction-linethickness.html both fraction bars should have a .5em linethickness. The first by MathML attributes ; the second by the MATH table.
Created attachment 224374 [details] testcase (requires STIX Math)
Created attachment 224375 [details] WIP Patch Here is an updated patch that applies on top of the one of bug 128907 and reads the glyph assembly from the MATH table.
Created attachment 224379 [details] Screenshot with the patches applied (WebKitGTK+)
Created attachment 224508 [details] WIP Patch This new version adds support for size variants. However, the alignment and stretch size is not good. The improvements from bug 119043 should probably be taken before. There are a couple of rendering issues that would need bug 99620 too. The ENABLE_OPENTYPE_MATH flag compilation now behaves like this: - Enabled on ports that can read Open Type Tables (IIUC freetype & cg/cairo on windows). Then the MATH table is read and so any such open type font is supported. Try e.g. http://www.maths-informatique-jeux.com/ulule/mathml_torture_test/ - Disabled on other ports. In that case the data from the MATH table are hardcoded. Currently, only STIX Math is supported as I think it is installed by default on Mac. Hopefully we will be able to replace this with direct access to the MATH table in the future.
Created attachment 224510 [details] Python script to extract the MATH data from the STIX Math fonts
Created attachment 224640 [details] WIP Patch
Created attachment 224662 [details] Patch V1
Created attachment 224663 [details] Screenshot of the torture test (STIX-Word WebKitGTK+) The previous patch integrates the changes from bug 99620, bug 119043 and 128907. That seems to work relatively well. Here is a screenshot for STIX-Word. You can try other MATH fonts here: http://www.maths-informatique-jeux.com/ulule/mathml_torture_test/. I still have to make the patch build on Windows/Mac and check if the glyph measuring/drawing works.
Created attachment 225254 [details] Patch Refresh the patch. This adds largeop (always consider displaystyle for now).
Created attachment 225255 [details] Screenshot of the torture test (Latin-Modern WebKitGTK+) Here is a screenshot that shows large integrals and sums. (the most obvious bugs are missing italic correction on scripts, no horizontal stretching and missing mathvariant).
Created attachment 225353 [details] Another testcase (you can download it and modify the font-family)
Created attachment 225355 [details] Patch for testing
Created attachment 225366 [details] Patch for testing Trying to fix some build failures...
Attachment 225366 [details] did not pass style-queue: ERROR: Source/WebCore/mathml/MathMLInlineContainerElement.h:43: The parameter name "change" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 56 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 225366 [details] Patch for testing Attachment 225366 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/4956107214684160 New failing tests: mathml/presentation/attributes-mathvariant.html mathml/presentation/inferred-mrow-stretchy.html mathml/presentation/mo-stretch.html mathml/presentation/stretchy-depth-height-symmetric.html mathml/presentation/bug97990.html platform/mac/accessibility/mathml-elements.html mathml/presentation/stretchy-depth-height.html mathml/presentation/mo-stretchy-vertical-bar.html mathml/presentation/scripts-subsup.html
Created attachment 225377 [details] Archive of layout-test-results from webkit-ews-01 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-01 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 225366 [details] Patch for testing Attachment 225366 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5611600291561472 New failing tests: mathml/presentation/attributes-mathvariant.html mathml/presentation/inferred-mrow-stretchy.html mathml/presentation/bug97990.html svg/masking/mask-negative-scale.svg mathml/presentation/mo-stretch.html mathml/presentation/stretchy-depth-height-symmetric.html platform/mac/accessibility/mathml-elements.html mathml/presentation/stretchy-depth-height.html mathml/presentation/mo-stretchy-vertical-bar.html mathml/presentation/scripts-subsup.html
Created attachment 225388 [details] Archive of layout-test-results from webkit-ews-06 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-06 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 225366 [details] Patch for testing Attachment 225366 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/4562359007838208 New failing tests: mathml/presentation/attributes-mathvariant.html mathml/presentation/inferred-mrow-stretchy.html mathml/presentation/mo-stretch.html mathml/presentation/stretchy-depth-height-symmetric.html mathml/presentation/bug97990.html platform/mac/accessibility/mathml-elements.html mathml/presentation/stretchy-depth-height.html mathml/presentation/mo-stretchy-vertical-bar.html mathml/presentation/scripts-subsup.html
Created attachment 225399 [details] Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-14 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Comment on attachment 225366 [details] Patch for testing Attachment 225366 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5242164384628736 New failing tests: mathml/presentation/attributes-mathvariant.html mathml/presentation/inferred-mrow-stretchy.html mathml/presentation/bug97990.html svg/masking/mask-negative-scale.svg mathml/presentation/mo-stretch.html mathml/presentation/stretchy-depth-height-symmetric.html platform/mac/accessibility/mathml-elements.html mathml/presentation/stretchy-depth-height.html mathml/presentation/mo-stretchy-vertical-bar.html mathml/presentation/scripts-subsup.html
Created attachment 225400 [details] Archive of layout-test-results from webkit-ews-02 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-02 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 225366 [details] Patch for testing Attachment 225366 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6174855724531712 New failing tests: mathml/presentation/attributes-mathvariant.html mathml/presentation/inferred-mrow-stretchy.html mathml/presentation/bug97990.html svg/masking/mask-negative-scale.svg mathml/presentation/mo-stretch.html mathml/presentation/stretchy-depth-height-symmetric.html platform/mac/accessibility/mathml-elements.html mathml/presentation/stretchy-depth-height.html mathml/presentation/mo-stretchy-vertical-bar.html mathml/presentation/scripts-subsup.html
Created attachment 225401 [details] Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-16 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Created attachment 225998 [details] Patch This patch relies on the work of bug 128907 and preserves the old math fonts by default.
Created attachment 225999 [details] Patch 124838+115787+115786+128907+122297 for testing
Comment on attachment 225999 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 225999 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6624831931940864 New failing tests: platform/mac/accessibility/mathml-elements.html mathml/presentation/fractions-linethickness.html mathml/presentation/mo-stretch.html
Created attachment 226007 [details] Archive of layout-test-results from webkit-ews-15 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-15 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Comment on attachment 225999 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 225999 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/6252974737195008 New failing tests: platform/mac/accessibility/mathml-elements.html mathml/presentation/fractions-linethickness.html mathml/presentation/mo-stretch.html
Created attachment 226017 [details] Archive of layout-test-results from webkit-ews-07 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-07 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 225999 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 225999 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5544390764265472 New failing tests: platform/mac/accessibility/mathml-elements.html mathml/presentation/fractions-linethickness.html mathml/presentation/mo-stretch.html
Created attachment 226022 [details] Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-10 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Comment on attachment 225999 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 225999 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5572263759839232 New failing tests: platform/mac/accessibility/mathml-elements.html mathml/presentation/fractions-linethickness.html mathml/presentation/mo-stretch.html
Created attachment 226025 [details] Archive of layout-test-results from webkit-ews-04 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 225999 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 225999 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/4642688150274048 New failing tests: platform/mac/accessibility/mathml-elements.html mathml/presentation/fractions-linethickness.html mathml/presentation/mo-stretch.html
Created attachment 226032 [details] Archive of layout-test-results from webkit-ews-05 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-05 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Created attachment 226107 [details] Patch 124838+115787+115786+128907+122297 for testing
Comment on attachment 226107 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 226107 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/6225898994925568 New failing tests: platform/mac/accessibility/mathml-elements.html mathml/presentation/mo-stretch.html
Created attachment 226119 [details] Archive of layout-test-results from webkit-ews-08 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-08 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 226107 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 226107 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5292223839076352 New failing tests: platform/mac/accessibility/mathml-elements.html mathml/presentation/mo-stretch.html
Created attachment 226120 [details] Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-10 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Comment on attachment 226107 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 226107 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/4506743845421056 New failing tests: platform/mac/accessibility/mathml-elements.html mathml/presentation/mo-stretch.html
Created attachment 226122 [details] Archive of layout-test-results from webkit-ews-01 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-01 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 226107 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 226107 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5491906263908352 New failing tests: platform/mac/accessibility/mathml-elements.html mathml/presentation/mo-stretch.html
Created attachment 226126 [details] Archive of layout-test-results from webkit-ews-05 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-05 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Created attachment 226338 [details] Patch 124838+115787+115786+128907+122297 for testing
Attachment 226338 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h:48: The parameter name "platformData" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 55 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 226338 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 226338 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5823104613875712 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226350 [details] Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-13 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Comment on attachment 226338 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 226338 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5733496026824704 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226356 [details] Archive of layout-test-results from webkit-ews-07 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-07 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 226338 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 226338 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6025493673410560 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226357 [details] Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-09 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Comment on attachment 226338 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 226338 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/6601005869301760 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226364 [details] Archive of layout-test-results from webkit-ews-02 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-02 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 226338 [details] Patch 124838+115787+115786+128907+122297 for testing Attachment 226338 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5446831119007744 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226371 [details] Archive of layout-test-results from webkit-ews-06 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-06 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Created attachment 226508 [details] Patch
Created attachment 226510 [details] Patch + 128907 for testing
Created attachment 226597 [details] Patch + 128907 for testing Trying to implement
(In reply to comment #63) > Trying to implement ... a cache.
Created attachment 226680 [details] Patch
Attachment 226680 [details] did not pass style-queue: ERROR: Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:1594: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:1622: One line control clauses should not use braces. [whitespace/braces] [4] Total errors found: 2 in 22 files If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 226768 [details] Patch
Comment on attachment 226768 [details] Patch Attachment 226768 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6177913875464192 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226773 [details] Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-09 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Comment on attachment 226768 [details] Patch Attachment 226768 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5013578306289664 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226780 [details] Archive of layout-test-results from webkit-ews-04 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 226768 [details] Patch Attachment 226768 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5732714745430016 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226782 [details] Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-12 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Comment on attachment 226768 [details] Patch Attachment 226768 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5697530373341184 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226787 [details] Archive of layout-test-results from webkit-ews-05 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-05 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Comment on attachment 226768 [details] Patch Attachment 226768 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/6470236328951808 New failing tests: mathml/presentation/mo-stretch.html
Created attachment 226793 [details] Archive of layout-test-results from webkit-ews-07 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-07 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Created attachment 226840 [details] Patch
Created attachment 226844 [details] Patch Refreshing because of merge conflicts after bug 130090...
Can you post a revised patch for this now that the dependent changes have landed?
(In reply to comment #80) > Can you post a revised patch for this now that the dependent changes have > landed? This patch from 2014 is essentially subsumed by the work done in the past months. I believe we can close this bug since we now support the most important features of the MATH table. Other follow-up bugs can be opened for the remaining ones.