5
$\begingroup$

Exporting graphics to SVG in Mathematica defaults to converting all the text to outlines, at least since version 11 as far as I can tell. This is more robust for viewing on different devices, but it seems superfluous for normal text. It also means that the file size is much larger than it would be if you exported to PDF and then used a separate converter such as MuTool or The Vector Converter to convert the PDF to SVG. These tools treat text as text, obtaining smaller file size at the risk that special symbols won't render properly for everyone.

Minimal example using this code, exporting as SVG and comparing output with result from exporting as PDF and converting that to SVG. The latter case shows the Greek letters in the wrong font, but is half the file size. I tried the undocumented .svgz option but that throws an error in every browser I've tried, even after changing it to .svg.

testdata = Accumulate[RandomVariate[NormalDistribution[0, 1], 300]];

testgraph = 
 ListLinePlot[testdata, Frame -> True, 
  PlotLabel -> Style["\[Alpha] + \[Beta] issue", Black], 
  BaseStyle -> {Darker@Blue, 16}]

This feels a bit back-to-the future given a very old question by me, but is an effort to finesse an output format that wasn't available back then. The use case I have in mind does have the same $PrivateFontOptions option set by default, but I have replicated the problem in a fresh session.

I'd really like to have a direct-from-Mathematica export option that generates smaller files, ideally by leaving ASCII text as styled text directives in the SVG markup, and outlining only the special math characters. Is there an option I've missed?

(PS: Hello! It's been a long time.)

$\endgroup$
1
$\begingroup$

Sorry, but you cannot alter how text is generated in SVG.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.