Bug 1446321 [wpt PR 9993] - MathML: Test italic correction of sub and super scripts attached to a large operator, a=testonly

Automatic update from web-platform-testsMathML: Test italic correction of sub and super scripts attached to a large operator (#9993)

wpt-commits: 74126cb3c187c5993d16d30d4f13368a3f7dc943
wpt-pr: 9993
wpt-commits: 74126cb3c187c5993d16d30d4f13368a3f7dc943
wpt-pr: 9993
This commit is contained in:
Frédéric Wang 2018-04-09 17:38:09 +00:00 коммит произвёл James Graham
Родитель 11d4479db8
Коммит 0153037b1d
4 изменённых файлов: 170 добавлений и 1 удалений

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

@ -272640,6 +272640,11 @@
{}
]
],
"fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff": [
[
{}
]
],
"fonts/math/largeop-displayoperatorminheight5000.woff": [
[
{}
@ -339176,6 +339181,12 @@
{}
]
],
"mathml/presentation-markup/scripts/subsup-parameters-2.html": [
[
"/mathml/presentation-markup/scripts/subsup-parameters-2.html",
{}
]
],
"mathml/presentation-markup/scripts/underover-1.html": [
[
"/mathml/presentation-markup/scripts/underover-1.html",
@ -552215,6 +552226,10 @@
"a218eeab3238839be7d0cc8c326e57d59bd51f83",
"support"
],
"fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff": [
"8ace2a167d3e3a7f27af99431b5626834dac53a8",
"support"
],
"fonts/math/largeop-displayoperatorminheight5000.woff": [
"04f15e131b1ae051eeddbfda429ca154d2c6bda0",
"support"
@ -573135,6 +573150,10 @@
"a9198166947a3d181d21d2597d167d3962c67f6e",
"testharness"
],
"mathml/presentation-markup/scripts/subsup-parameters-2.html": [
"3f3d721e1f0eec90d0b173f02f01a5d4ac16a8cc",
"testharness"
],
"mathml/presentation-markup/scripts/underover-1.html": [
"372c5f1e01a0fe5e3350579985e4f586838c0ed2",
"testharness"
@ -573488,7 +573507,7 @@
"support"
],
"mathml/tools/largeop.py": [
"46adcf9fce7218942711b6ca3742d74fce096c7f",
"cbf53783db1381e6fb0d22296d395104c4b6b545",
"support"
],
"mathml/tools/limits.py": [

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

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

@ -0,0 +1,132 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Subscripts and Superscripts parameters</title>
<link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#SS4">
<meta name="assert" content="Elements msub, msup, subsup and msubsup correctly use the italic correction from the MATH table.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
math, mspace {
font-size: 10px;
}
@font-face {
font-family: largeop-displayoperatorminheight5000;
src: url("/fonts/math/largeop-displayoperatorminheight5000.woff");
}
@font-face {
font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;
src: url("/fonts/math/largeop-displayoperatorminheight2000-2AFF-italiccorrection3000.woff");
}
</style>
<script>
function getBox(aId) {
return document.getElementById(aId).getBoundingClientRect();
}
setup({ explicit_done: true });
window.addEventListener("load", function() {
// Delay the check to workaround WebKit's bug https://webkit.org/b/174030.
requestAnimationFrame(() => { document.fonts.ready.then(runTests); });
});
/*
These two tests verify that:
- In msub, the script is at the right of the base minus the italic correction.
- In msup, the script is just at the right of the base.
- In msubsup, the scripts are shifted by the italic correction.
- In mmultiscripts, postscript pairs are shifted by the italic correction.
- In mmultiscripts, prescript pairs are vertically aligned.
*/
var epsilon = 1;
function runTests() {
test(function() {
var v = 0;
assert_approx_equals(getBox("base001").right - getBox("sub001").left, v, epsilon, "msub");
assert_approx_equals(getBox("sup002").left, getBox("base002").right, epsilon, "msup");
assert_approx_equals(getBox("sup003").left - getBox("sub003").left, v, epsilon, "msubsup");
assert_approx_equals(getBox("sup004").left - getBox("sub004").left, v, epsilon, "mmultiscripts postscripts");
assert_approx_equals(getBox("sup005").left - getBox("sub005").left, 0, epsilon, "mmultiscripts prescripts");
}, "Null Italic Correction");
test(function() {
var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000
var v = 3000 * emToPx;
assert_approx_equals(getBox("base011").right - getBox("sub011").left, v, epsilon, "msub");
assert_approx_equals(getBox("sup012").left, getBox("base012").right, epsilon, "msup");
assert_approx_equals(getBox("sup013").left - getBox("sub013").left, v, epsilon, "msubsup");
assert_approx_equals(getBox("sup014").left - getBox("sub014").left, v, epsilon, "mmultiscripts postscripts");
assert_approx_equals(getBox("sup015").left - getBox("sub015").left, 0, epsilon, "mmultiscripts prescripts");
}, "NonNull Italic Correction");
done();
}
</script>
</head>
<body>
<div id="log"></div>
<h2>Null Italic Correction</h2>
<p>
<math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
<msub>
<mo id="base001" lspace="0px" rspace="0px">&#x2AFF;</mo>
<mspace id="sub001" height="1em" width="1em" mathbackground="blue"/>
</msub>
</math>
<math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
<msup>
<mo id="base002" lspace="0px" rspace="0px">&#x2AFF;</mo>
<mspace id="sup002" height="1em" width="1em" mathbackground="blue"/>
</msup>
</math>
<math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
<msubsup>
<mo lspace="0px" rspace="0px">&#x2AFF;</mo>
<mspace id="sub003" height="1em" width="1em" mathbackground="blue"/>
<mspace id="sup003" height="1em" width="1em" mathbackground="green"/>
</msubsup>
</math>
<math displaystyle="true" style="font-family: largeop-displayoperatorminheight5000;">
<mmultiscripts>
<mo lspace="0px" rspace="0px">&#x2AFF;</mo>
<mspace id="sub004" height="1em" width="1em" mathbackground="blue"/>
<mspace id="sup004" height="1em" width="1em" mathbackground="green"/>
<mprescripts/>
<mspace id="sub005" height="1em" width="1em" mathbackground="magenta"/>
<mspace id="sup005" height="1em" width="1em" mathbackground="cyan"/>
</mmultiscripts>
</math>
</p>
<h2>NonNull Italic Correction</h2>
<p>
<math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
<msub>
<mo id="base011" lspace="0px" rspace="0px">&#x2AFF;</mo>
<mspace id="sub011" height="1em" width="1em" mathbackground="blue"/>
</msub>
</math>
<math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
<msup>
<mo id="base012" lspace="0px" rspace="0px">&#x2AFF;</mo>
<mspace id="sup012" height="1em" width="1em" mathbackground="blue"/>
</msup>
</math>
<math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
<msubsup>
<mo lspace="0px" rspace="0px">&#x2AFF;</mo>
<mspace id="sub013" height="1em" width="1em" mathbackground="blue"/>
<mspace id="sup013" height="1em" width="1em" mathbackground="green"/>
</msubsup>
</math>
<math displaystyle="true" style="font-family: largeop-displayoperatorminheight2000-2AFF-italiccorrection3000;">
<mmultiscripts>
<mo lspace="0px" rspace="0px">&#x2AFF;</mo>
<mspace id="sub014" height="1em" width="1em" mathbackground="blue"/>
<mspace id="sup014" height="1em" width="1em" mathbackground="green"/>
<mprescripts/>
<mspace id="sub015" height="1em" width="1em" mathbackground="magenta"/>
<mspace id="sup015" height="1em" width="1em" mathbackground="cyan"/>
</mmultiscripts>
</math>
</p>
</body>
</html>

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

@ -12,3 +12,21 @@ g = f.createChar(-1, "uni2AFF.display")
mathfont.drawRectangleGlyph(g, mathfont.em, v1, 0)
f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
mathfont.save(f)
v1 = 2 * mathfont.em
v2 = 3 * mathfont.em
f = mathfont.create("largeop-displayoperatorminheight%d-2AFF-italiccorrection%d" % (v1, v2))
f.copyright = "Copyright (c) 2018 Igalia S.L."
f.math.DisplayOperatorMinHeight = v1
mathfont.createSquareGlyph(f, nAryWhiteVerticalBarCodePoint)
g = f.createChar(-1, "uni2AFF.display")
p = g.glyphPen()
p.moveTo(0, 0)
p.lineTo(v2, v1)
p.lineTo(v2 + mathfont.em, v1)
p.lineTo(mathfont.em, 0)
p.closePath();
g.width = mathfont.em + v2
g.italicCorrection = v2
f[nAryWhiteVerticalBarCodePoint].verticalVariants = "uni2AFF uni2AFF.display"
mathfont.save(f)