Bug 1231404 - SubscriptBaselineDropMin or SuperscriptBaselineDropMax are not read from the MATH table. r=jfkthame

This commit is contained in:
Frédéric Wang 2015-12-27 08:37:00 -05:00
Родитель 8e78cac4b3
Коммит ad52fc9642
5 изменённых файлов: 48 добавлений и 5 удалений

Просмотреть файл

@ -203,6 +203,14 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
scriptSpace = nsPresContext::CSSPointsToAppUnits(0.5f); scriptSpace = nsPresContext::CSSPointsToAppUnits(0.5f);
} }
// Try and read sub and sup drops from the MATH table.
if (mathFont) {
subDrop = mathFont->
GetMathConstant(gfxFontEntry::SubscriptBaselineDropMin, oneDevPixel);
supDrop = mathFont->
GetMathConstant(gfxFontEntry::SuperscriptBaselineDropMax, oneDevPixel);
}
// force the scriptSpace to be at least 1 pixel // force the scriptSpace to be at least 1 pixel
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1); nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
scriptSpace = std::max(onePixel, scriptSpace); scriptSpace = std::max(onePixel, scriptSpace);
@ -390,8 +398,11 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
// subscript // subscript
subScriptFrame = childFrame; subScriptFrame = childFrame;
GetReflowAndBoundingMetricsFor(subScriptFrame, subScriptSize, bmSubScript); GetReflowAndBoundingMetricsFor(subScriptFrame, subScriptSize, bmSubScript);
// get the subdrop from the subscript font if (!mathFont) {
GetSubDropFromChild (subScriptFrame, subDrop, aFontSizeInflation); // get the subdrop from the subscript font
GetSubDropFromChild (subScriptFrame, subDrop, aFontSizeInflation);
}
// parameter v, Rule 18a, App. G, TeXbook // parameter v, Rule 18a, App. G, TeXbook
minSubScriptShift = bmBase.descent + subDrop; minSubScriptShift = bmBase.descent + subDrop;
trySubScriptShift = std::max(minSubScriptShift,subScriptShift); trySubScriptShift = std::max(minSubScriptShift,subScriptShift);
@ -431,8 +442,10 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
// supscript // supscript
supScriptFrame = childFrame; supScriptFrame = childFrame;
GetReflowAndBoundingMetricsFor(supScriptFrame, supScriptSize, bmSupScript); GetReflowAndBoundingMetricsFor(supScriptFrame, supScriptSize, bmSupScript);
// get the supdrop from the supscript font if (!mathFont) {
GetSupDropFromChild (supScriptFrame, supDrop, aFontSizeInflation); // get the supdrop from the supscript font
GetSupDropFromChild (supScriptFrame, supDrop, aFontSizeInflation);
}
// parameter u, Rule 18a, App. G, TeXbook // parameter u, Rule 18a, App. G, TeXbook
minSupScriptShift = bmBase.ascent - supDrop; minSupScriptShift = bmBase.ascent - supDrop;
nscoord superscriptBottomMin; nscoord superscriptBottomMin;

Просмотреть файл

@ -9,7 +9,7 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<style type="text/css"> <style type="text/css">
math { math, mspace {
font-size: 10px; font-size: 10px;
} }
@font-face { @font-face {
@ -44,6 +44,10 @@
font-family: scripts-8; font-family: scripts-8;
src: url(/tests/fonts/math/scripts-8.otf); src: url(/tests/fonts/math/scripts-8.otf);
} }
@font-face {
font-family: scripts-9;
src: url(/tests/fonts/math/scripts-9.otf);
}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
@ -107,6 +111,14 @@
ok(almostEqual(getBox("ref10").bottom - getBox("sup10").bottom, 9 * 10), ok(almostEqual(getBox("ref10").bottom - getBox("sup10").bottom, 9 * 10),
"Bad SuperscriptBottomMin"); "Bad SuperscriptBottomMin");
ok(almostEqual(getBox("base11").bottom + 3 * 10,
getBox("sub11").top),
"Bad SubscriptBaselineDrop");
ok(almostEqual(getBox("base11").top + 5 * 10,
getBox("sup11").bottom),
"Bad SuperscriptBaselineDrop");
SimpleTest.finish(); SimpleTest.finish();
} }
</script> </script>
@ -264,5 +276,17 @@
</math> </math>
</p> </p>
<p>
<math style="font-family: scripts-9;">
<msubsup>
<mspace id="base11" height="10em" depth="10em"
width="1em" mathbackground="red"/>
<mspace id="sub11"
height="0em" depth="1em" width="1em" mathbackground="green"/>
<mspace id="sup11"
height="1em" depth="0em" width="1em" mathbackground="blue"/>
</msubsup>
</math>
</p>
</body> </body>
</html> </html>

Просмотреть файл

@ -479,6 +479,11 @@ f = newMathFont("scripts-8")
f.math.SuperscriptBottomMin = 9 * em f.math.SuperscriptBottomMin = 9 * em
saveMathFont(f) saveMathFont(f)
f = newMathFont("scripts-9")
f.math.SubscriptBaselineDropMin = 3 * em
f.math.SuperscriptBaselineDropMax = 5 * em
saveMathFont(f)
################################################################################ ################################################################################
# Testing Limits Parameters # Testing Limits Parameters
f = newMathFont("limits-1") f = newMathFont("limits-1")

Просмотреть файл

@ -31,6 +31,7 @@ support-files =
/tests/fonts/math/scripts-6.otf /tests/fonts/math/scripts-6.otf
/tests/fonts/math/scripts-7.otf /tests/fonts/math/scripts-7.otf
/tests/fonts/math/scripts-8.otf /tests/fonts/math/scripts-8.otf
/tests/fonts/math/scripts-9.otf
/tests/fonts/math/stack-1.otf /tests/fonts/math/stack-1.otf
/tests/fonts/math/stack-2.otf /tests/fonts/math/stack-2.otf
/tests/fonts/math/stack-3.otf /tests/fonts/math/stack-3.otf

Двоичные данные
layout/reftests/fonts/math/scripts-9.otf Normal file

Двоичный файл не отображается.