haikuwebkit/LayoutTests/mathml/opentype/opentype-stretchy.html

42 lines
1.1 KiB
HTML
Raw Permalink Normal View History

Use size variants and glyph assembly from the MATH data. https://bugs.webkit.org/show_bug.cgi?id=130322 Reviewed by Chris Fleizach. Source/WebCore: This patch modifies the RenderMathMLOperator code to use the MATH table when one is provided in the current font on the <math> tag. More precisely, the MathVariants table is used to draw a size variant or a glyph assembly. The displaystyle attribute is not supported yet, so for now large operators are always assumed to be in display style. The MATH support does not work well with all platforms+fonts, so at the moment the default font-family on the <math> is not changed. Tests: mathml/opentype/large-operators-LatinModern.html mathml/opentype/opentype-stretchy.html mathml/opentype/vertical-LatinModern.html * css/mathml.css: We only specify the default font-family on the math root, so that people can easily style the mathematics. For now, old fonts without the MATH table are still used as the default. (math): (math, mfenced > *): Deleted. (mo, mfenced): Deleted. * platform/graphics/SimpleFontData.cpp: don't return the math data if the font is loading. (WebCore::SimpleFontData::mathData): * platform/graphics/opentype/OpenTypeMathData.cpp: update #ifdef so that disabling ENABLE_OPENTYPE_MATH won't lead to errors with unused parameters. (WebCore::OpenTypeMathData::OpenTypeMathData): (WebCore::OpenTypeMathData::getMathConstant): (WebCore::OpenTypeMathData::getItalicCorrection): (WebCore::OpenTypeMathData::getMathVariants): * rendering/mathml/RenderMathMLOperator.cpp: (WebCore::RenderMathMLOperator::boundsForGlyph): (WebCore::RenderMathMLOperator::heightForGlyph): (WebCore::RenderMathMLOperator::advanceForGlyph): (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): We handle preferred width of size variants. (WebCore::RenderMathMLOperator::shouldAllowStretching): This function now only returns whether the operator will stretch and no longer has side effect. (WebCore::RenderMathMLOperator::getGlyphAssemblyFallBack): We add a function to convert from the MathVariant table data to the format supported by RenderMathMLOperator. (WebCore::RenderMathMLOperator::getDisplayStyleLargeOperator): We add a function to get the glyph that will be used for large operators in display style. (WebCore::RenderMathMLOperator::findStretchyData): We make this function handle size variants. (WebCore::RenderMathMLOperator::updateStyle): We handle size variants. (WebCore::RenderMathMLOperator::paint): We handle size variants. * rendering/mathml/RenderMathMLOperator.h: LayoutTests: This adds some pixel tests for large operators and vertical stretchy operators. * mathml/opentype/LICENSE-LatinModern.txt: Added. * mathml/opentype/large-operators-LatinModern.html: Added. * mathml/opentype/latinmodern-math.woff: Added. * mathml/opentype/opentype-stretchy.html: Added. * mathml/opentype/stretchy.woff: Added. * mathml/opentype/vertical-LatinModern.html: Added. * platform/efl/mathml/opentype/large-operators-LatinModern-expected.png: Added. * platform/efl/mathml/opentype/large-operators-LatinModern-expected.txt: Added. * platform/efl/mathml/opentype/opentype-stretchy-expected.png: Added. * platform/efl/mathml/opentype/opentype-stretchy-expected.txt: Added. * platform/efl/mathml/opentype/vertical-LatinModern-expected.png: Added. * platform/efl/mathml/opentype/vertical-LatinModern-expected.txt: Added. * platform/gtk/mathml/opentype/large-operators-LatinModern-expected.png: Added. * platform/gtk/mathml/opentype/large-operators-LatinModern-expected.txt: Added. * platform/gtk/mathml/opentype/opentype-stretchy-expected.png: Added. * platform/gtk/mathml/opentype/opentype-stretchy-expected.txt: Added. * platform/gtk/mathml/opentype/vertical-LatinModern-expected.png: Added. * platform/gtk/mathml/opentype/vertical-LatinModern-expected.txt: Added. * platform/gtk/mathml/presentation/mo-stretch-expected.png: update reference due to change in mathml.css * platform/gtk/mathml/presentation/mo-stretch-expected.txt: ditto * platform/mac/mathml/opentype/large-operators-LatinModern-expected.txt: Added. * platform/mac/mathml/opentype/opentype-stretchy-expected.txt: Added. * platform/mac/mathml/opentype/vertical-LatinModern-expected.txt: Added. * platform/mac-wk2/mathml/opentype/large-operators-LatinModern-expected.txt: Added. * platform/mac-wk2/mathml/opentype/opentype-stretchy-expected.txt: Added. * platform/mac-wk2/mathml/opentype/vertical-LatinModern-expected.txt: Added. * platform/win/TestExpectations: Mark the OpenType MATH tests as failing Canonical link: https://commits.webkit.org/151267@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@169305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-05-24 04:56:50 +00:00
<!doctype html>
<html>
<head>
<title>Open Type MATH - stretchy operator</title>
<meta charset="utf-8"/>
<style type="text/css">
/* This font is taken from Mozilla's test suite. */
@font-face {
font-family: stretchy;
src: url("stretchy.woff");
}
math {
font-family: stretchy;
font-size: 10px;
}
</style>
</head>
<body>
<!-- This checks various vertical size variants. -->
<p>
<math><mrow><mo symmetric="false" stretchy="true" minsize="1em">&#x219F;</mo></mrow></math>
<math><mrow><mo symmetric="false" stretchy="true" minsize="2em">&#x219F;</mo></mrow></math>
<math><mrow><mo symmetric="false" stretchy="true" minsize="3em">&#x219F;</mo></mrow></math>
</p>
<!-- This checks vertical glyph assembly. -->
<p>
<math><mrow><mo symmetric="false" stretchy="true" minsize="15em">&#x219F;</mo></mrow></math>
</p>
<!-- This checks large operator in display style. -->
<p>
<math displaystyle="true">
<mrow><mo>&#x2A1B;</mo></mrow>
</math>
</p>
</body>
</html>