Page MenuHomePhabricator

SVG height incorrect
Closed, ResolvedPublic



I tested the MathML SVG mode and it seems that the height is incorrect and the bottom of the image is cut-off.

screenshot attached. Apple Safari

Version: unspecified
Severity: normal




Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:32 AM
bzimport set Reference to bz70119.
TheDJ created this task.Aug 28 2014, 10:37 AM

physik wrote:

Thanks for reporting this.
I'm not sure if that's a problem of the Math extension of a problem of the SVG itself.
Does the SVG cropped for you as well?

physik wrote:

I played a bit with the options. I think the hight is too small. If we'd add a few percent to the height the problem would be solved. Do you think that would be a good solution?

fredw added a comment.Aug 28 2014, 4:41 PM

Does MathJax still returns the image height in relative CSS units (ex)? I'm not sure we can be convert them reliably into px...

Pkra added a comment.Aug 28 2014, 5:46 PM

I don't think the problem is in the height (increasing it will only scale the image) but other CSS effects, leading to clipping. From a quick try, stripping the style from the SVG seems to fix this so perhaps having the inline style both within the SVG and on the img tag is causing trouble.

TheDJ added a comment.Sep 3 2014, 2:15 PM

Found it.

It's primarily the styling on the SVG element itself. That adds two 2px of margin (which are not part of the SVG sizes).

Then on the inline image element, we add another 2px. Remove those two and everything works just fine.

physik wrote:

That means it's a problem on the server side.

Change 165861 had a related patch set uploaded by GWicke:
Bug 70119: Strip style from SVG image

Change 165861 merged by jenkins-bot:
Bug 70119: Strip style from SVG image

Change 165949 had a related patch set uploaded by GWicke:
Revert "Bug 70119: Strip style from SVG image"

Change 165949 merged by GWicke:
Revert "Bug 70119: Strip style from SVG image"

This should be basically fixed for new formulas. Old formulas already in the database might still have the old margins, and will need to be cleared.

I believe that one way to do this is is ?action=purge&mathpurge=true, although in my tests that did not work reliably. I'm keeping this bug open until this is verified fixed in production.