Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure 0 remains 0 when rounding to pixels (plus a bit). #1461

Merged
merged 2 commits into from May 17, 2016

Conversation

Projects
None yet
3 participants
@dpvc
Copy link
Member

commented May 4, 2016

Make sure rounded pixel values (which have a slight bit extra added to them) don't have the extra added to them when they are near 0. Resolves issue #1452.

@@ -2937,7 +2937,9 @@
// Add the width to the span (outside the MathJax class, so uses outer em size,
// which makes it work even when minimum font size is in effect).
//
span.style.width = HTMLCSS.Em(Math.max(0,Math.round(math.bbox.w*this.em)+.25)/HTMLCSS.outerEm);
var W = math.bbox.w;
if (Math.abs(W) < .006) W = 0; else W = Math.max(0,Math.round(W*this.em)+.25);

This comment has been minimized.

Copy link
@zorkow

zorkow May 11, 2016

Member

W = Math.abs(W) < .006 ? 0 : Math.max(0,Math.round(W*this.em)+.25);

For readability.

This comment has been minimized.

Copy link
@dpvc

dpvc May 11, 2016

Author Member

Sounds good.

@dpvc

This comment has been minimized.

Copy link
Member Author

commented May 12, 2016

Made your suggested change.

@pkra pkra added this to the MathJax v2.x.x milestone May 17, 2016

@zorkow

This comment has been minimized.

Copy link
Member

commented May 17, 2016

lgtm.

@dpvc dpvc merged commit 2649818 into mathjax:develop May 17, 2016

@dpvc dpvc deleted the dpvc:issue1452 branch May 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.