Announcement

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

  • Font family in graph window is not exported to PDF

    Hi there,

    I want to export my graph with the CMU Serif font I have installed on my computer.

    The font is shown in the graph windows but not preserved in the exported PDF.

    I have tested the code below:

    Code:
    graph set window fontface "CMU Serif"
    
    webuse uslifeexp
    line le year
    
    graph export "CO2e_udledninger.pdf", as(pdf) name("Graph") fontface("CMU Serif") replace

  • #2
    I can replicate your problem with Stata 18 latest version. I had to reregister my Adobe fonts again in Windows 10 and they can be selected in MS Word again but cannot be selected in the Stata graph preferences dialog box.

    Comment


    • #3
      I tested it further. It looks like Stata is not using all of the fonts registered in Windows - some of my Adobe fonts are not selectable in Stata.
      With pdf-export I have tested it now with a font selectable in Stata and the font is displayed in the graph window but not in the pdf-export.

      Comment


      • #4
        Hi Marc

        I can select CMU Serif (self installed) in the Stata graph preferences dialog box. And the font is shown correct in the graph window as well. But I cannot get a PDF with the correct font.

        Comment


        • #5
          Peter Baltzer Stidsen and Marc Kaulisch,

          How did you install the font? When you right-click the font files, you will see two choices to install the fonts, "Install" and "Install for all users". You need to click "Install for all users". In this way, the fonts will be installed in C:\Windows\Fonts directory. This is where PDF export finds the system font. If you click "Install", it will be installed in C:\Users\YOU_USER_NAME\AppData\Local\Microsoft\Win dows\Fonts instead.

          Comment


          • #6
            Zhao Xu (StataCorp)

            The font was installed in my user folder. Reinstalling the font for all users worked!

            Thanks a lot! :-)

            Comment


            • #7
              Originally posted by Zhao Xu (StataCorp) View Post
              Peter Baltzer Stidsen and Marc Kaulisch,

              How did you install the font? When you right-click the font files, you will see two choices to install the fonts, "Install" and "Install for all users". You need to click "Install for all users". In this way, the fonts will be installed in C:\Windows\Fonts directory. This is where PDF export finds the system font. If you click "Install", it will be installed in C:\Users\YOU_USER_NAME\AppData\Local\Microsoft\Win dows\Fonts instead.
              Do you know how I get this problem solved with fonts administered by Adobe Creative Cloud?

              Comment


              • #8
                Hi, I have the same problem with exporting a graph in JPEG format whereby the font in the graph window (Lupo) is not carried over into the JPEG export.

                Lupo has now been "installed for all users" as suggested above but has not fixed the problem (and I have restarted).

                I'm using Stata 17.

                Code:
                graph set window fontface "Lato"
                
                /* graph commands not shown */
                
                graph export "N:\ASgraphtest11.jpg", as(jpg) name("Graph") width(800) height(378) quality(100) replace
                Many thanks

                Gareth

                Comment


                • #9
                  Marc Kaulisch,

                  You may need to contact the font vendor to check whether those fonts can be embedded in other applications.

                  Comment


                  • #10
                    Gareth Davies,

                    You can use the fontface() option to set the font for .jpg export. For your case, you can type

                    Code:
                    graph export "N:\ASgraphtest11.jpg", as(jpg) name("Graph") width(800) height(378) quality(100) fontface("Lato") replace
                    In this way, there is also no need to set the window fontface.

                    Comment


                    • #11
                      Zhao Xu (StataCorp)

                      Thanks for getting back to me, I had tried that but got this error message:

                      Code:
                      . graph export "N:\ASgraphtest11.jpg", as(jpg) name("Graph") width(800) height(378) quality(100) fontface("Lato") replace
                      option fontface() not allowed
                      r(198);
                      Is it because I'm using Stata 17?

                      Comment


                      • #12
                        Gareth Davies,

                        You can type

                        Code:
                        update query
                        to check whether you have the latest update. It was added in one of our updates.

                        Comment


                        • #13
                          Zhao Xu (StataCorp)

                          Thank you very much, that now runs and the jpeg export shows the fonts in Lato.

                          Lesson learnt to run the updates more often and always before posting a problem on here. If only we could update Stata without raising an IT ticket.

                          Many thanks again.

                          Comment

                          Working...
                          X