Announcement

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

  • Adding a font to Stata

    Hello,

    I'm trying to create a set of graphs with the font Century Schoolbook. I have the font installed on my computer, but it doesn't appear in the list of fonts when I go to Preferences to change it. And Stata doesn't recognize the font when I try to change it by using
    Code:
    graph set
    . Does anyone know how I can get Stata to recognize this font? It does appear to be a Stata-compatible font, because it's recognized as a font in some of the help materials (see here, under "Fonts, advanced.")

    Thanks so much for your help.

    Lucia

  • #2
    I see this font in the list found in the preferences of a graph window (say, draw a scatter plot and go to Edit->Preferences), and it has an effect on axes when I select Century Schoolbook. However, other fonts I have don't show up in the list - but these are fonts from Linotype, and they may be in a format not recognized by Stata (namely, it's Frutiger and Egyptienne).

    Comment


    • #3
      I will say that when I do, in Stata 15.1 for Mac
      Code:
      sysuse auto clear
      scatter mpg weight
      graph set window fontface "Century Schoolbook"
      it seems that Stata does not recognize the font, in that there is no effect on the displayed graph. However, if i click the Graph Editor window, it then seems to take effect in the displayed graph. if do the graph set before the scatter, it takes effect when the scatter plot is drawn. So graph set must precede the drawing of the graph.

      This may or may not be relevant to your problem. The difficulty is, you did not tell us the command you issued - clearly it was more than
      Code:
      graph set
      but without knowing what you did, and in what relation to your graph command, it's hard to know what went wrong.

      Comment


      • #4
        I tried all versions of graph set, and I did "graph set" before I set the graph. I am running Stata 14.

        I tried typing this:
        Code:
        graph set window fontface "Century Schoolbook"
        graph set window fontfacesans "Century Schoolbook"
        graph set window fontfaceserif "Century Schoolbook"
        graph set window fontfacemono "Century Schoolbook"
        graph set window fontfacesymbol "Century Schoolbook"
        
        graph set ps fontface "Century Schoolbook"
        graph set ps fontfacesans "Century Schoolbook"
        graph set ps fontfaceserif "Century Schoolbook"
        graph set ps fontfacemono "Century Schoolbook"
        graph set ps fontfacesymbol "Century Schoolbook"
        
        graph set eps fontface "Century Schoolbook"
        graph set eps fontfacesans "Century Schoolbook"
        graph set eps fontfaceserif "Century Schoolbook"
        graph set eps fontfacemono "Century Schoolbook"
        graph set eps fontfacesymbol "Century Schoolbook"
        
        graph set svg fontface "Century Schoolbook"
        graph set svg fontfacesans "Century Schoolbook"
        graph set svg fontfaceserif "Century Schoolbook"
        graph set svg fontfacemono "Century Schoolbook"
        graph set svg fontfacesymbol "Century Schoolbook"
        And then after setting the graph for every possible display, I plotted the graph. It doesn't appear to work in either the graph that's produced or the graph editor window. Any other ideas?

        Comment


        • #5
          I find it interesting that in the font menu in Stata > Preferences > Graph on my copy of Stata 15.1 for Mac, the font is listed as "CenturySchoolbook" (with no embedded space), yet my specification of "Century Schoolbook" (with an embedded space) worked OK on the graph, but left the font menu set to " ". However, specifying "CenturySchoolbook" also worked OK on the graph, and additionally left the font menu set to "CenturySchoolbook".

          This is long-way-around to suggesting that perhaps on your Stata, specifying "CenturySchoolbook" with no embedded space may solve the problem, if that is also the way it appears in the font menu, or maybe even if it is not.

          Comment


          • #6
            Ah, that's interesting. Thank you, William Lisowski . I think this might be the issue--the font isn't listed in my menu preferences at all, with or without spaces. Do you know where Stata pulls this list of fonts from, and how I can add a font to the list?

            Thanks so much.

            Comment


            • #7
              I know where it pulls the font list from on Stata for Mac - it lists every font installed on the system, including fonts that the Apple-supplied font menus do not show. I will add that all the fonts I have installed are in the system /Library/Fonts folder, not in the ~/Library/Fonts folder within my account, so I cannot confirm that accounts installed in my account only would show up.

              I have no idea how fonts are handled on Windows or Linux systems. I would say generically that you should take care to confirm that the Century Schoolbook font you believe is installed is indeed installed for access by all applications on the system, and not just Microsoft Office or TeX or some other individual application or suite.

              Comment


              • #8
                Hello everyone,



                My dataset is in Mongolian cyrillic texts. When I open them in Stata 11.2 , it was readable by changing fonts. However, when I open the file in stata18, it simply converted as diamond shapes and no fonts convert them into readable cyrrilic. Can someone help me please?

                Thank you.

                Amaraa

                Comment


                • #9
                  Dear Amarjargal,

                  Possibly you have not installed this particular font on your Windows system using the option "Install for all users".
                  This was discussed in a recent post Font family in graph window is not exported to PDF by Zhao Xu (StataCorp) in his entry #5.
                  Note that you have to use the File Explorer application and then go to the folder where your font now is located.
                  Next, set the mouse focus on this font (i.e. the one with 'regular' in its file name) and then trigger a right-mouse-button-click-event.
                  Then the file properties panel should open like:
                  Click image for larger version

Name:	Windows Install Font for All Users 1.png
Views:	1
Size:	130.5 KB
ID:	1741012




                  Note that on my Windows 11 system only the option - Install - is listed (when your system has another version of Windows the panel might look different and already include the option - Install for all users - ).
                  But for me, it means that in this case the option - Show more options - should be selected (triggered) as to get the next panel to open:
                  Click image for larger version

Name:	Windows Install Font for All Users 2.png
Views:	1
Size:	24.9 KB
ID:	1741013




                  Now you can see that the option - Install for all users - is indeed now listed and that has to be selected (triggered) to have your font (again) installed on your system but now in the folder C:\Users\YOUR_USER_NAME\...etc.
                  It is there where Stata looks for the font(s) to use for an export to PDF.

                  Consult the manual / help file for more information about using fonts:
                  Code:
                  h graph_set
                  Last edited by ericmelse; 24 Jan 2024, 10:25.
                  http://publicationslist.org/eric.melse

                  Comment


                  • #10
                    Hi Everyone,

                    I follow the thread as this is the closest to what I am trying to do, and I hope someone can help me.

                    In general, the 'graph set window/ps/eps/svg fontface*' works in my laptop and I have control over the graphs, thanks to this thread. However, not the same story in the supercomputer of my institution where the system runs in Unix.

                    I did what Lucia Goin was trying to do in May 2018, but using "Serif" instead across all possible settings. I did this, because I know that Serif is one of the choices in the Graph editor, so it is not that I don't have the font installed. In fact, I know I can change the graph in the GUI through the graph editor. However I am using batch, and it would great if I could do this in the code.

                    When writing graph set window fontface* "Serif", I get the following error: font 'Serif' not found; using 'Nimbus Roman' instead. I can change the font to "Times" and I get the analogous error.

                    Has anybody experienced this? How can I work around it?

                    Thanks a lot for your consideration... Maybe someone can help with this.

                    Felipe LR

                    Comment

                    Working...
                    X