Skip to content

Commit 2649818

Browse files
committed
Merge pull request #1461 from dpvc/issue1452
Make sure 0 remains 0 when rounding to pixels (plus a bit). Resolves issue #1452.
2 parents ce4982f + 19b813a commit 2649818

File tree

1 file changed

+4
-2
lines changed
  • unpacked/jax/output/HTML-CSS

1 file changed

+4
-2
lines changed

unpacked/jax/output/HTML-CSS/jax.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1007,8 +1007,8 @@
10071007
return m.toFixed(3).replace(/\.?0+$/,"") + "em";
10081008
},
10091009
EmRounded: function (m) {
1010-
m = (Math.round(m*HTMLCSS.em)+.05)/HTMLCSS.em;
10111010
if (Math.abs(m) < .0006) {return "0em"}
1011+
m = (Math.round(m*HTMLCSS.em)+.05)/HTMLCSS.em;
10121012
return m.toFixed(3).replace(/\.?0+$/,"") + "em";
10131013
},
10141014
unEm: function (m) {
@@ -2936,7 +2936,9 @@
29362936
// Add the width to the span (outside the MathJax class, so uses outer em size,
29372937
// which makes it work even when minimum font size is in effect).
29382938
//
2939-
span.style.width = HTMLCSS.Em(Math.max(0,Math.round(math.bbox.w*this.em)+.25)/HTMLCSS.outerEm);
2939+
var W = math.bbox.w;
2940+
W = Math.abs(W) < .006 ? 0 : Math.max(0,Math.round(W*this.em)+.25);
2941+
span.style.width = HTMLCSS.EmRounded(W/HTMLCSS.outerEm);
29402942
span.style.display = "inline-block";
29412943
//
29422944
// Adjust bbox to match outer em-size

0 commit comments

Comments
 (0)