Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fonts and glyphs not displaying in pdf after -graph export filename, as(pdf)-

    Hi, I wonder if anyone can help (and please forgive that I don't really understand the things I'm talking about here)

    The below is using Stata/IC 14.2 on Windows 7. I cannot see that it has been discussed before on Statalist (though this thread is related)

    Take the following code:
    Code:
    graph set window fontface "Lucida Sans"
    tw function 0, tit("←↑→↓↔↕↖↗↘↙↨" "{&uarr}{&uArr}{&larr}{&lArr}{&rarr}{&rArr}{&darr}{&dArr}")
    translator set Graph2pdf fontface "Lucida Sans"
    graph export test.pdf, as(pdf)
    A screenshot of test.pdf is shown below. The unicode characters have all failed to render, despite appearing in the Stata graph. Less obvious is that the first {&uarr} is not even replaced by a rectangle, it's just completely absent (which particularly concerns me).


    Click image for larger version

Name:	test.png
Views:	1
Size:	3.9 KB
ID:	1394741


    In help whatsnew 13to14, we are told that graphs containing unicode should be exported to PDF, since PS and EPS do not support unicode. But when I export the above to eps, it at least shows me the {&uarr}.

    A few questions:
    1. How is Stata replacing Lucida Sans in the graph window? (The Lucida Sans does not contain these glyphs)
    2. Can this replacement be mimicked when exporting to PDF? (I don't think anyone would complain about a change of font to facilitate seeing the text!
    3. Are there any particularly safe fonts for exporting to PDF?
    4. Is there any way to tell if there is a problem?
    5. Will all this be fixed in Stata 15? When will that be?!
    Any insight gratefully received! With apologies again for not understanding any the machinery at work here.

    Tim

  • #2
    The only insight I can provide is that, in my installation
    Code:
    Stata/SE 14.2 for Mac (64-bit Intel)
    Revision 04 May 2017
    Copyright 1985-2015 StataCorp LLC
    the view of the PDF in Preview is identical to the view of the graph window. Lucida Sans is installed system-wide on my Mac, and it does contain the glyphs in question. Perhaps (as in, this is a guess with nothing except experience to back it up) on your installation (presuming it's not a Mac) the Stata executable/library includes its own complete Lucida Sans, which displays correctly within the application in the Graph window, but your PDF viewer does not have access to a similarly complete Lucida Sans? This is sort of the reverse of your supposition in #1: I'm asserting Stata does no substitution, and your PDF viewer is failing to substitute for characters it is missing.

    You might try viewing your PDF on other systems. Or upload it, and Statalist members can see what their experience is with it.

    My understanding years ago was that these problems are circumvented by embedding the font (or the necessary subset thereof) in the PDF document.

    Added in edit: with luck, here is my PDF.

    Lucida.pdf

    And a further edit: dumping the PDF suggests to me that it was created with embedded fonts, so it may well look OK in your PDF viewer. I'd hoped that it would be incomplete, which would have lent strength to the hypothesis that the incomplete Lucida Sans is the source of your problem within your PDF viewer.
    Last edited by William Lisowski; 25 May 2017, 10:47.

    Comment


    • #3
      I can replicate the OP's problem with Stata 14.2 on Windows 10 Pro.

      But when I print the graph using the Microsoft Print to PDF printer driver, the PDF file created does render properly in Adobe Acrobat Reader DC.

      For what it's worth, in the first case (replicated failure), the PDF document's Fonts property says "Lucida Sans (Embedded Subset)" and "[Adobe] Symbol", and in the second (successful) it is "CIDFont+F1 (Embedded)" and "CIDFont+F2 (Embedded)"

      Comment


      • #4
        Many thanks both.

        Joseph - this is really useful to know that printing does get the job done. Thought it's a shame this cannot just be run within a .do file (still requires some user interaction).

        William - You say:
        the Stata executable/library includes its own complete Lucida Sans, which displays correctly within the application in the Graph window
        It's not that because I can see the same issues happening for unusual fonts that definitely don't come pre-packaged in a Stata library. Does Stata do this at all? James Hassell of Stata says that the Mac PDF engine is much better than Windows so these problems don't seem to come up as much.

        Any other thoughts welcome. Hopefully version 15 will include Type 1 support so we can use pro fonts with much larger character sets!

        Thanks, Tim

        Comment

        Working...
        X