OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>mo axis height</title> |
| 6 <link rel="help" href="http://www.mathml-association.org/MathMLinHTML5/S3.html#S
S2.SSS4"> |
| 7 <meta name="assert" content="Element mo correctly uses the axis height parameter
from the MATH table."> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <style> |
| 11 math, mspace { |
| 12 font-size: 10px; |
| 13 } |
| 14 @font-face { |
| 15 font-family: axisheight5000-verticalarrow14000; |
| 16 src: url("/fonts/math/axisheight5000-verticalarrow14000.woff"); |
| 17 } |
| 18 </style> |
| 19 <script> |
| 20 var emToPx = 10 / 1000; // font-size: 10px, font.em = 1000 |
| 21 var epsilon = 5; |
| 22 |
| 23 function getBox(aId) { |
| 24 return document.getElementById(aId).getBoundingClientRect(); |
| 25 } |
| 26 |
| 27 setup({ explicit_done: true }); |
| 28 window.addEventListener("load", function() { |
| 29 document.fonts.ready.then(runTests); |
| 30 }); |
| 31 |
| 32 function runTests() { |
| 33 test(function() { |
| 34 var v1 = 5000 * emToPx; |
| 35 var moMiddle = (getBox("mo1").bottom + getBox("mo1").top) / 2; |
| 36 assert_approx_equals(getBox("mo1").height, |
| 37 14000 * emToPx, epsilon, "mo: size"); |
| 38 assert_approx_equals(getBox("baseline1").bottom - moMiddle, |
| 39 v1, epsilon, "mo: axis height"); |
| 40 }, "AxisHeight (size variant)"); |
| 41 |
| 42 test(function() { |
| 43 var v1 = 5000 * emToPx; |
| 44 var moMiddle = (getBox("mo2").bottom + getBox("mo2").top) / 2; |
| 45 assert_approx_equals(getBox("mo2").height, |
| 46 2 * (getBox("target2").height - v1), |
| 47 epsilon, "mo: size"); |
| 48 assert_approx_equals(getBox("baseline2").bottom - moMiddle, |
| 49 v1, epsilon, "mo: axis height"); |
| 50 }, "AxisHeight (glyph assembly)"); |
| 51 |
| 52 done(); |
| 53 } |
| 54 </script> |
| 55 </head> |
| 56 <body> |
| 57 <p> |
| 58 <math style="font-family: axisheight5000-verticalarrow14000;"> |
| 59 <mrow> |
| 60 <mspace id="baseline1" mathbackground="blue" width="50px" height="1px"/> |
| 61 <mpadded voffset="50px"><mspace mathbackground="cyan" width="50px" heigh
t="1px"/></mpadded> |
| 62 <mo id="mo1" symmetric="true" mathcolor="green">↨</mo> |
| 63 <mspace mathbackground="gray" width="10px" height="50px"/> |
| 64 </mrow> |
| 65 </math> |
| 66 <math style="font-family: axisheight5000-verticalarrow14000;"> |
| 67 <mrow> |
| 68 <mspace id="baseline2" mathbackground="blue" width="50px" height="1px"/> |
| 69 <mpadded voffset="50px"><mspace mathbackground="cyan" width="50px" heigh
t="1px"/></mpadded> |
| 70 <mo id="mo2" symmetric="true" mathcolor="green">↨</mo> |
| 71 <mspace id="target2" mathbackground="gray" width="10px" height="200px"/> |
| 72 </mrow> |
| 73 </math> |
| 74 </p> |
| 75 </body> |
| 76 </html> |
OLD | NEW |