8

Please consider the following, version 10.0.1, OS X Mavericks:

SetOptions[$FrontEndSession, PrivateFontOptions -> {"OperatorSubstitution" -> False}]

fakedata = FoldList[0.98 #1 + #2 &, 2., RandomVariate[NormalDistribution[0, 1], 11]]   
(*{2., 2.39063, 2.58035, 1.30193, 0.758044, 1.47053, 2.81647, \
2.30642, 1.12738, -1.07766, -2.03465, -1.38781} *)

test0 = BarChart[fakedata, PlotTheme -> "None"]

enter image description here

Now export test0 as a PDF, and open in Adobe Reader to check the fonts.

enter image description here

Clearly, the special Mathematica fonts are being used still. It is clearly visible in the minus signs in the original graphic in the notebook.

I want to turn OperatorSubstitution off in EMF export on Windows, because it causes issues when embedding the EMF graphics in Word or PowerPoint. I did this test in PDF format on Mac OS X (my home machine, work is yet to upgrade) but have reason to believe that the font-export behaviour is the same.

  • Can anyone confirm that the behaviour is the same on Windows, either for PDF or EMF export?
  • If so, can anyone suggest a way to enforce the version-9 behaviour of respecting the setting for PrivateFontOptions? The documentation says:

This function has not been fully integrated into the long-term Wolfram Language, and is subject to change.

Am I out of luck in the new version? I was hoping to use version 10 given its improved PDF export, but I can't expect outside organisations to have installed the Mathematica fonts just so we can show a couple of simple charts in a PowerPoint. This sort of thing can be a showstopper for a large organisation.

Verbeia
  • 34,233
  • 9
  • 109
  • 224
  • 1
    Doesn't work with Linux and 10.0.1 either. The output of "pdffonts" shows MathematicaSans whenever there are negative values on the y-axis. – grbl Oct 13 '14 at 11:50
  • 1
    Windows 7 and Mathematica 10.0.1: Same result – Thomas Oct 13 '14 at 12:02
  • The best what I can recommend is to save the charts from Acrobat to PNG with sufficient resolution and then insert them in PowerPoint. Actually Mathematica's PDF export in v.10.0.1 is still broken in many ways as compared to v.8. And I still cannot see in what sense it is "improved". – Alexey Popkov Oct 13 '14 at 12:27
  • @AlexeyPopkov - this is not a sufficient solution, unfortunately, because non-vector graphics look rubbish when we resize them, which is necessary for including them in Word. For what it's worth, I do regard the v10 PDF export as improved over version 9 because at least embedded fonts are being correctly subsetted now. – Verbeia Oct 13 '14 at 21:52
  • @Thomas - would you mind checking how EMF format exported plots work in Word/PowerPoint on a computer without the Mathematica fonts installed? – Verbeia Oct 13 '14 at 22:00
  • @Verbeia For including graphics in Word it is best to have it as EPS: the best vector quality + embedded fonts. For PowerPoint presentations it is best to have graphics as PNG with resolution above the default (I usually export with 300 dpi from Acrobat, although it is probably an overkill): it looks excellent and is completely independent on any fonts. – Alexey Popkov Oct 14 '14 at 05:15
  • @AlexeyPopkov - I wish, but we have tested this extensively (for three years! :-) and (1) EPS doesn't actually work that well on Windows and if you then convert the Word/PowerPoint to PDF, the whole graphic shows as a black box. Also EPS doesn't embed fonts the way PDF does. Meanwhile (2) the powers that be at work have deemed the output quality from PNG to be unacceptable, given that they sometimes need to adjust the size when including it in PowerPoint, depending on how many footnotes. Given that EMF works in v9, they probably just won't upgrade. – Verbeia Oct 14 '14 at 06:04
  • @Verbeia I'm quite happy with the combination: MS Word 2003 + Adobe Acrobat 11 PDFMaker plugin. Word 2003 correctly imports EPS files and Acrobat PDFMaker generates PDF of excellent quality. I do know that not every PDF printer can use the EPS code embedded in a Word document because the most of them generate PDF from EMF file in the printer spool, not from the PostScript file generated by Word. – Alexey Popkov Oct 14 '14 at 06:18
  • The PNG output quality from Mathematica is usually unacceptable - this is the reason why I recommend to use Adobe Acrobat for generating PNG. With Acrobat you can set higher resolution and the quality will always be excellent when you adjust the size of the PNG image in PowerPoint. – Alexey Popkov Oct 14 '14 at 06:25
  • @Verbeia - Export["test0.emf", test0] will export a rasterized image, while Export["test1.emf", test0 /. Opacity[_] -> Sequence[]] will export a vector graphics. When placing this in Word, selecting it and ungrouping it, all the elements were individually selectable. However: The numbers jumped to the top left of the image, but not the minus signs. They stayed in place like all other elements. – Thomas Oct 14 '14 at 12:33
  • @Thomas - thanks for checking. I'm mainly interested in whether the Mathematica fonts are needed in simple graphs using only things like minus signs and percentage signs, in version 10. As I only have version 10 for Mac at the moment, I can't test EMF because that's Windows-only. – Verbeia Oct 14 '14 at 21:59

2 Answers2

6

I contacted Wolfram Support, who replied:

Thanks for your email. We actually changed the implementation of the option "OperatorSubstitution" in Mathematica 10, and now it's a global option. What happens is that the default FormatType used in graphics is "TraditionalForm", and this style has the default setting of "OperatorSubstitution" to True. To workaround this issue, we can edit the stylesheet or change the option of this style.

SetOptions[$FrontEndSession, 
 StyleDefinitions -> 
  Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
   Cell[StyleData["TraditionalForm"], 
   PrivateFontOptions -> {"OperatorSubstitution" -> False}]}]]

According to my testing, this works on Mac OS, but now that I also have a Windows version (10.0.2), I cannot make the same thing work there.

Verbeia
  • 34,233
  • 9
  • 109
  • 224
  • 2
    (+1) It is interesting that Options[$FrontEndSession, StyleDefinitions] returns an error Options::optnf: StyleDefinitions is not a known option for $FrontEndSession. even after evaluating the suggested code. CurrentValue[$FrontEndSession, StyleDefinitions] returns $Failed. – Alexey Popkov Oct 25 '14 at 07:35
4

Since this appears to still be broken under Mathematica 10.3 on Windows, consider the following workaround based on the solution provided by Verbeia:

nb = EvaluationNotebook[];
SetOptions[
 nb,
 StyleDefinitions -> 
  Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
    Cell[StyleData["TraditionalForm"], 
     PrivateFontOptions -> {"OperatorSubstitution" -> False}]}]
 ]

For some weird reason the above code snippet does not work when EvaluationNotebook[] is used directly in SetOptions[].

Guest
  • 56
  • 2
  • This works, thanks! If I can only work out how to make it work in my hopelessly convoluted packages that then talk to .Net.... sigh – Verbeia Feb 11 '16 at 22:22