WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
133569
The OpenType MATH table is not read on Mac
https://bugs.webkit.org/show_bug.cgi?id=133569
Summary
The OpenType MATH table is not read on Mac
Frédéric Wang (:fredw)
Reported
2014-06-06 01:01:28 PDT
At the moment, the OpenType MATH table has been successfully read on EFL & GTK (I tested that) and Windows (Gurpreet tested that). From the screenshots provided by Chris, it seems that this does not work on Mac at the moment (I'm not sure for which version). This would require some debugging, for example: 1) Of the OpenTypeMathData::OpenTypeMathData function, to see if the table is well created and the headers validated. 2) Of the OpenTypeMathData::getMathVariants function, to see if sizeVariants and assemblyParts vectors are well created. 3) Of the OpenTypeMathData::getMathConstant function, to see if the constant is correctly read. 3) Of the RenderMathMLOperator::getDisplayStyleLargeOperator to see if the minheight and size variant is correctly picked. For a minimal testcase, consider LayoutTests/mathml/opentype/large-operators-LatinModern.html (only one <mo> element is needed). At the moment I can't do that myself.
Attachments
testcase (includes WOFF as base64 data)
(2.23 KB, text/html)
2014-06-07 07:19 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Python script used to generate the WOFF file
(2.05 KB, text/plain)
2014-06-07 07:19 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Screenshot of the testcase (WebKitGTK+)
(14.89 KB, image/png)
2014-06-07 07:25 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Patch to do some logging
(5.47 KB, patch)
2014-06-07 08:34 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Screenshot
(105.54 KB, image/png)
2014-06-20 02:07 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Patch
(548 bytes, patch)
2014-06-20 02:48 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch
(3.22 KB, patch)
2014-06-20 23:40 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from webkit-ews-07 for mac-mountainlion
(850.51 KB, application/zip)
2014-06-21 05:59 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2
(822.16 KB, application/zip)
2014-06-21 06:21 PDT
,
Build Bot
no flags
Details
Patch
(56.66 KB, patch)
2014-06-22 01:48 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch
(59.80 KB, patch)
2014-06-22 01:53 PDT
,
Frédéric Wang (:fredw)
cfleizach
: review+
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Frédéric Wang (:fredw)
Comment 1
2014-06-07 07:19:18 PDT
Created
attachment 232658
[details]
testcase (includes WOFF as base64 data)
Frédéric Wang (:fredw)
Comment 2
2014-06-07 07:19:48 PDT
Created
attachment 232659
[details]
Python script used to generate the WOFF file
Frédéric Wang (:fredw)
Comment 3
2014-06-07 07:25:38 PDT
Created
attachment 232660
[details]
Screenshot of the testcase (WebKitGTK+) Here is how the testcase renders on WebKitGTK+ The woff font contains (at least) two glyphs 1) a small square for Unicode Character 'N-ARY SUMMATION' (U+2211). 2) a larger square for N-ARY SUMMATION in displaystyle mode. 1) is used in the <mtext> 2) should be used for the <mo> since the operator <math> has displaystyle=true The DisplayOperatorMinHeight constant is set to the height of the larger square.
Frédéric Wang (:fredw)
Comment 4
2014-06-07 07:57:35 PDT
WebKit/Blink contains the following comment: // OTTag is native because it's only compared against constants, so we don't // do endian conversion here but make sure constants are in big-endian order. // Note that multi-character literal is implementation-defined in C++0x. typedef uint32_t Tag; #define OT_MAKE_TAG(ch1, ch2, ch3, ch4) ((((uint32_t)(ch4)) << 24) | (((uint32_t)(ch3)) << 16) | (((uint32_t)(ch2)) << 8) | ((uint32_t)(ch1))) Interestingly, Gecko does that in a different order: #define TRUETYPE_TAG(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxFontUtils.h#323
Apple doc:
https://developer.apple.com/library/ios/documentation/graphicsimaging/Reference/CGFont/Reference/reference.html#//apple_ref/c/func/CGFontCopyTableForTag
Frédéric Wang (:fredw)
Comment 5
2014-06-07 08:34:07 PDT
Created
attachment 232662
[details]
Patch to do some logging Here is a patch to do some logging. I'd appreciate if someone could load the testcase on Mac and tell the output. As a comparison, on Linux I get the following data: OpenTypeMathData::OpenTypeMathData m_mathBuffer->size(): 360 m_mathBuffer: 00010000000A00FFFFFFE0012E math header valid math constants subtable OK math variants subtable OK OpenTypeMathData::getMathConstant constant=3 value=2000 OpenTypeMathData::getMathVariants got mathGlyphConstruction sizeVariants: [2 3 ]
Tim Horton
Comment 6
2014-06-20 00:56:20 PDT
(In reply to
comment #5
)
> Created an attachment (id=232662) [details] > Patch to do some logging > > Here is a patch to do some logging. I'd appreciate if someone could load the testcase on Mac and tell the output.
I've emailed you the output.
Frédéric Wang (:fredw)
Comment 7
2014-06-20 01:35:10 PDT
(In reply to
comment #6
)
> (In reply to
comment #5
) > > Created an attachment (id=232662) [details] [details] > > Patch to do some logging > > > > Here is a patch to do some logging. I'd appreciate if someone could load the testcase on Mac and tell the output. > > I've emailed you the output.
Thank you very much, Tim. So apparently, the MATH table is not loaded at all. Reading the Mac code, I see that Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm has a static function static CFDataRef copyFontTableForTag(FontPlatformData& platformData, FourCharCode tableName) { return CGFontCopyTableForTag(platformData.cgFont(), tableName); } that is used to read tables that way: RetainPtr<CFDataRef> os2Table = adoptCF(copyFontTableForTag(m_platformData, 'OS/2')); Are you able to copy copyFontTableForTag into Source/WebCore/platform/graphics/FontPlatformData.cpp and then use it in FontPlatformData::openTypeTable with a hardcoded 'MATH' string: if (RetainPtr<CFDataRef> data = adoptCF(copyFontTableForTag(cgFont(), 'MATH')) return ...; ...just to see if the MATH table is loaded?
Frédéric Wang (:fredw)
Comment 8
2014-06-20 02:07:01 PDT
Created
attachment 233418
[details]
Screenshot So it seems that it was just some kind of endianness issue. I'll try to work on a patch to fix that. FYI, here is a screenshot of
http://www.maths-informatique-jeux.com/ulule/mathml_torture_test/latinmodern2math.html
provided by Tim.
Frédéric Wang (:fredw)
Comment 9
2014-06-20 02:48:20 PDT
Created
attachment 233419
[details]
Patch So I'm not sure I understand the comment about "OTTag is native because it's only compared against constants" (
comment 4
). Anyway, MATHTag is only used in OpenTypeMathData.cpp so I guess it is safe to take this small patch to switch to FourCharCode on Mac. If the vertical data code is enabled on Mac or if more Open Type tables are read, I guess we should find a coherent way to handle all the platforms & endianness. @Tim, can you please try again this patch?
Tim Horton
Comment 10
2014-06-20 19:29:48 PDT
(In reply to
comment #9
)
> Created an attachment (id=233419) [details] > Patch > > So I'm not sure I understand the comment about "OTTag is native because it's only compared against constants" (
comment 4
). Anyway, MATHTag is only used in OpenTypeMathData.cpp so I guess it is safe to take this small patch to switch to FourCharCode on Mac. If the vertical data code is enabled on Mac or if more Open Type tables are read, I guess we should find a coherent way to handle all the platforms & endianness. > > @Tim, can you please try again this patch?
It works.
Frédéric Wang (:fredw)
Comment 11
2014-06-20 23:40:20 PDT
Created
attachment 233512
[details]
Patch Could someone please update the text and image references for mathml/opentype/opentype-stretchy.html mathml/opentype/opentype-stretchy-horizontal.html ?
Alexey Proskuryakov
Comment 12
2014-06-21 00:17:44 PDT
Comment on
attachment 233512
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=233512&action=review
> LayoutTests/ChangeLog:9 > + Other tests require a font with a MATH table to be installed on Mac bots and to be used by default (
bug 133603
).
The way we normally achieve this is by loading fonts dynamically (as with Ahem).
Frédéric Wang (:fredw)
Comment 13
2014-06-21 00:26:54 PDT
(In reply to
comment #12
)
> The way we normally achieve this is by loading fonts dynamically (as with Ahem).
See the summary of my IRC discussion with Martin on
bug 134094
. I already used a small "fake font" to test basic stretching (horizontal, vertical and largeop), but to test "real examples" with several math operators, it's probably not a good idea to keep Latin Modern Math in the source (add a license, size of ~500ko). Anyway, it will be necessary for Apple to have an Open Type MATH table installed on Mac/iOS if you want to benefit from the improved MathML rendering, without requiring Web authors to use Web fonts (compare
attachment 233418
[details]
with
https://drfhlmcehrc34.cloudfront.net/cache/67/2f/672f5b477badfeccc6a2c06619a0c2c2.png
).
Frédéric Wang (:fredw)
Comment 14
2014-06-21 03:27:27 PDT
Comment on
attachment 233512
[details]
Patch This was supposed to be a review request.
Build Bot
Comment 15
2014-06-21 05:58:56 PDT
Comment on
attachment 233512
[details]
Patch
Attachment 233512
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.appspot.com/results/6485853182361600
New failing tests: mathml/opentype/opentype-stretchy-horizontal.html mathml/opentype/opentype-stretchy.html
Build Bot
Comment 16
2014-06-21 05:59:00 PDT
Created
attachment 233531
[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
Build Bot
Comment 17
2014-06-21 06:21:12 PDT
Comment on
attachment 233512
[details]
Patch
Attachment 233512
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.appspot.com/results/6372120837750784
New failing tests: mathml/opentype/opentype-stretchy-horizontal.html mathml/opentype/opentype-stretchy.html
Build Bot
Comment 18
2014-06-21 06:21:17 PDT
Created
attachment 233532
[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
Frédéric Wang (:fredw)
Comment 19
2014-06-22 01:48:09 PDT
Created
attachment 233561
[details]
Patch
Frédéric Wang (:fredw)
Comment 20
2014-06-22 01:53:22 PDT
Created
attachment 233563
[details]
Patch
Frédéric Wang (:fredw)
Comment 21
2014-07-01 23:44:35 PDT
Committed
r170699
: <
http://trac.webkit.org/changeset/170699
>
Frédéric Wang (:fredw)
Comment 22
2014-07-02 02:16:15 PDT
I see new MathML failures that can safely be ignored for now as well as new tests that pass (although I think that's unrelated to this patch). Last time, someone told me on IRC that mac/win gardening should only be done by people doing mac/win development, so feel free to update the TestExpectations for Apple Win / Mac.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug