Skip to content

Commit 1ff00b1

Browse files
committed
mglyph -> mtext broke some images
1 parent 9bdb61c commit 1ff00b1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mathics/builtin/graphics.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3226,14 +3226,15 @@ def boxes_to_xml(self, leaves=None, **options):
32263226
svg,
32273227
)
32283228

3229-
return (
3230-
'<mtext><img width="%dpx" height="%dpx" src="data:image/svg+xml;base64,%s"/></mtext>'
3231-
% (
3229+
# mglyph, which is what we have been using, is bad because MathML standard changed.
3230+
# metext does not work beacause the way in which we produce the svg images is also based on this outdated mglyph behaviour.
3231+
# format = "<mtext><img width="%dpx" height="%dpx" src="data:image/svg+xml;base64,%s"/></mtext>"
3232+
template = '<mglyph width="%dpx" height="%dpx" src="data:image/svg+xml;base64,%s"/>'
3233+
return template % (
32323234
int(width),
32333235
int(height),
32343236
base64.b64encode(svg_xml.encode("utf8")).decode("utf8"),
32353237
)
3236-
)
32373238

32383239
def axis_ticks(self, xmin, xmax):
32393240
def round_to_zero(value):

0 commit comments

Comments
 (0)