8
$\begingroup$

If I export a PDF from Mathematica, then open it with Illustrator, the font glyphs will sometimes appear as boxes, depending on what font was used.

Why does this happen? Is there a workaround?

I experimented with several fonts in Graphics[{Text[Style["text", FontFamily -> "Arial"]]}]. Helvetica, Times, Helvetica Neue, Zapfino, Futura all appeared as boxes. Calibri, Arial, Georgia, Baskerville, Times New Roman all appeared correctly. What is the difference between these? All are accessible to Illustrator otherwise.

I have already read Edit a Mathematica plot in Illustrator, missing font problem. I have copied the Mathematica fonts to to ~/Library/Application Support/Adobe/Fonts and since then glyphs appear fine in Illustrator if I don't specify a custom font at all. The difference between this question and that one is that now I am asking about the situation when custom (non-default) fonts are used.

The fonts which don't work are all already accessible to Illustrator, but I tried to copy them to the Adobe/Fonts folder anyway. It didn't make a difference. I am on OS X 10.10.4, using Mathematica 10.1 and 10.2.

enter image description here

$\endgroup$
5
  • $\begingroup$ I long ago stopped worrying about font problems and instead always use this: First@ImportString[ExportString[Graphics[Text[Style["text",FontFamily->"Times"]]],"PDF"],"PDF"]. It's not completely fool-proof with exotic Unicode characters, but usually gives me what I want. $\endgroup$
    – Jens
    Jul 24, 2015 at 16:20
  • $\begingroup$ My previous comment won't make sense to most people without a reference: here is what it does: it creates outlines for text glyphs. Then you can export the result, and all text is rendered as vector curves in Illustrator. The TextMode option in the linked answer is no longer needed to make it work (but doesn't hurt, either). $\endgroup$
    – Jens
    Jul 24, 2015 at 16:36
  • $\begingroup$ AArrgh - I just tested the linked approach in version 10.1 and see it's now broken, too. I had been using version 8 until now, and it seems I that was lucky for me. For regular text, it still seems to work, but my example with 2D math is no longer exported correctly. I'll have to look into that, I guess. Why?? $\endgroup$
    – Jens
    Jul 24, 2015 at 16:41
  • $\begingroup$ @Jens It's possible to outline text with GhostScript (v9.16 or later). That's what I use in MaTeX. I have to check again how exactly $\endgroup$
    – Szabolcs
    Jul 24, 2015 at 16:43
  • $\begingroup$ Yes, I think I invented that approach many years ago see e.g. here: Use a custom export function. Here is another relevant link. Also, it seems the ImportString approach is broken because Import now can't import PDF properly anymore. So maybe ghostscript as in one of the mentioned links would be a workaround. But it doesn't really answer your question, of course. $\endgroup$
    – Jens
    Jul 24, 2015 at 16:47

2 Answers 2

2
$\begingroup$

(Not an answer, just an extended comment.)

I do not experience such problem with PDF files Exported by Mathematica 10.2 under Win7 x64 when opening them with Illustrator 17. The following is my check up.

Let us generate a Graphics containing all the fonts available for Mathematica:

test = Graphics[{MapIndexed[
    Text[Style[#, 10] -> Style["text", 20, FontFamily -> #1], #2] &, 
    Partition[FE`Evaluate[FEPrivate`GetPopupList["MenuListFonts"]][[;; , 1]], 47, 47, 
     1, {}], {2}]}, AspectRatio -> 1, ImageSize -> {Automatic, 800}]

screenshot1

We see that for some of the fonts the text string is not displayed inside of the FrontEnd. More informative graphics:

test = Graphics[{MapIndexed[
    Text[Style[#, 10] -> Style["text", 20, FontFamily -> #1], #2] &, 
    Partition[FE`Evaluate[FEPrivate`GetPopupList["MenuListFonts"]][[;; , 1]], 47, 47, 
     1, {}], {2}]}, AspectRatio -> 1, ImageSize -> {Automatic, 800}]

screenshot2

From this we see that only "Euclid Math One" and "Euclid Math Two" are not displayed. Both these fonts contain no letters and are intended for displaying mathematical formulas, so we should not blame on this.

Exporting:

Export["test.pdf", test]

Here is how exported PDF is rendered by Adobe Acrobat:

screenhot3

We see that some of the fonts are substituted, including "Euclid Math One" and "Euclid Math Two".

When I open this file with Illustrator 17 the following error window appear:

screenshot4

So "Fences" will be substituted. After pressing "OK" no other errors appear and here is how Illustrator renders the figure:

Illustrator export for Web

We see no boxes. The "Fences" font name is displayed as "Fences#20Plain* Regular*" but the actual displayed font seems to be "Times New Roman".

"Brush Script MT", "Bookshelf Symbol 7", "Fixedsys", "Euclid Symbol", "Euclid Math One", "Euclid Math Two", "Euclid Extra", "Mangal", "MT Extra", "MS Reference Specialty", "Harlow Solid Italic", "Script", "Roman", "Monotype Corsiva", "Modern", "Symbol", "Vivaldi", "Webdings", "Wingdings", "Wingdings 2", "Wingdings 3" and "ZWAdobeF" do present in the system but are substituted with "Tahoma".

"MS Serif" does present in the system but is substituted with "Times New Roman".

"Terminal" does present in the system but is substituted with "Courier New".

"MS Sans Serif", "Small Fonts" and "System" do present in the system but are substituted with "Arial".

The fonts "Arial Greek", "Arial Cyr", "Arial CYR", "Arial CE", "Arial Baltic", "Arabic Transparent", "Courier New TUR", "Courier New Greek", "Courier New Cyr", "Courier New CYR", "Courier New CE", "Courier New Baltic", "Marlett", "Times New Roman TUR", "Times New Roman Greek", "Times New Roman Cyr", Times New Roman CYR", "Times New Roman CE" and "Times New Roman Baltic" actually do not present in the system and are substituted with "Tahoma".

Other fonts seems to be recognized correctly. In some cases Illustrator displays the name of the font using Chinese characters, but for usual fonts it is OK.

$\endgroup$
4
  • $\begingroup$ When I try to export the result of this test, Mathematica crashes, unfortunately. It may also be that this is an OS-specific issue, I'm on OS X. So I can do some more tests, could you send me the result you get from FE`Evaluate[FEPrivate`GetPopupList["MenuListFonts"]]? I would like to test the intersection of the fonts we have installed. None of the random fonts I tried from your list had any problems on my machine either. But these seem to be only the ones that ship with Windows, so maybe it's the font format? I don't see any which ship with Illustrator in the list. $\endgroup$
    – Szabolcs
    Aug 14, 2015 at 10:01
  • $\begingroup$ Here it is. I have installed a couple of fonts since that time and I still have no problems with Exporting my test (I have re-checked it). And yes, I Export my test on a machine where Illustrator is NOT installed. $\endgroup$ Aug 14, 2015 at 13:05
  • $\begingroup$ Thanks! There are a few that misbehave. Here's the PDF and this is how Illustrator shows it. $\endgroup$
    – Szabolcs
    Aug 14, 2015 at 13:21
1
$\begingroup$

Analysis

I have taken a look at your misbehaving PDF file generated by Mathematica 10.2 on Mac OS X and here are my observations:

  1. Your PDF file should use 83 different fonts which names are listed in it. But the pdffonts utility (a part of Poppler utilities version 0.34) lists only 80 fonts (the listing is here). The missing fonts are: "Bookshelf Symbol 7", "Lucida Calligraphy", "Lucida Handwriting", "Marlett", "MS Reference Specialty", "MT Extra", "Symbol", "Webdings". All these fonts are installed in my system (Win7 x64). All of them are displayed as boxes in Illustrator 7 but Adobe Acrobat shows them with substitute fonts. I should note that among them only "Lucida Calligraphy" and "Lucida Handwriting" are intended for text display, others are special fonts which do not necessary contain textual elements at all. It is interesting that the pdffonts listing contains "Lucida Grande" (not installed in my system and not listed in your file) with type "CID TrueType" and encoding "Identity-H". The pdffonts listing also contains some other fonts which should not be present in the file. I also briefly checked the "Fonts" tab of Adobe Acrobat's "Document Properties" and it seems to be completely consistent with the pdffonts output.
  2. All the other fonts displayed by Illustrator as boxes have type "CID TrueType" and encoding "Identity-H". All the fonts displayed correctly has type "TrueType" and encoding "WinAnsi".

I have also checked the PDF file generated by Mathematica 10.2 on my system (Win7 x64). The pdffonts output for this file contains no fonts of type "CID TrueType" and/or encoding "Identity-H" (here is the listing). Adobe Illustrator shows this file without boxes.

So my conclusion is that when reading Mathematica-generated PDF files Illustrator has problems with fonts of type "CID TrueType" and encoding "Identity-H" and also with fonts which cannot be properly identified by the pdffonts utility.

A non-perfect workaround

I have opened your file in Adobe Acrobat 11.0.12 and printed it to the Adobe PDF printer. The PDF file obtained through this route is displayed without boxes by illustrator (but now it outlines some of the fonts when opens the file) and seems to look exactly as it looks in Adobe Acrobat. It is interesting this PDF also contains fonts of type "CID TrueType" and encoding "Identity-H" but now Illustrator correctly converts them into outlines.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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