Announcement

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

  • Graph text fonts in (absolute) point sizes

    I'm trying to coordinate Stata graphs with the text in a book. The (current) spec for the book text in 12pt Arial. Stata (for Windows) has no problem using Arial but it only defines relative sizes. Presumably, Stata picks up a font at a specific (point) size, but I can't find this defined anywhere. It surprised me that I can't find any previous discussion of this on the lists. So I ran this experiment, saved the graph as TIF, and imported it into a document with text using Arial at sizes from the word processor (OpenOffice rather than Word). After a little fiddling, the fonts *nearly* match

    #delimit ;
    twoway scatteri 0 0 10 10,
    xsize(6) ysize(3)
    text(0 0 "{stSans:Is this text 8pt}", box place(ne))
    text(1 0 "{stSans:Is this text 66pt}", box size(*8) place(ne))
    text(5 0 "{stSans:Is this text 72pt}", box size(*8.8) place(ne));

    Stata's 66pt is a *smidgen* larger than Windows, but the 72pt matches as close as I can measure - and subject to printer precision. So I deduce the Stata base font is approx 8.2pt in Windows terms and can more or less match an absolute size when the graph is defined by xsize and ysize and not pulled about.

    Does anyone have better ideas? Presumably a similar experiment would be needed for any substituted font.

    Allan

  • #2
    I did find a hint in documentation that (postscript) font sizes are based on the -ysize-. Changing from 3in to 4in did require me to change the multipliers, but not by 3/4. The "base" font now seems to be approx 8.4pt. Here's the updated test DO file.

    #delimit ;
    twoway scatteri 0 0 10 10,
    xsize(8) ysize(4)
    title( "{stSans:Is title 72pt}", box style(body) size(*8.58) place(l) )
    text(0 0 "{stSans:Is this text 10pt}", box place(ne))
    text(1 0 "{stSans:Is this text 66pt}", box size(*7.87) place(ne))
    text(5 0 "{stSans:Is this text 72pt}", box size(*8.58) place(ne));
    graph export textgraph.tif, replace;

    Comment


    • #3
      In my experience, you must rely on trial-and-error. ysize() determines the size of labels, markers, and text, but the size can be modified by the scale() option.

      Comment


      • #4
        More error and certainly a trial. The syntax that should give my required text size is -ysize(4) text( ..., size(4.16)) - , because size(#) is defined as #% of the ysize and 4.16% is 1/6 of an inch = 12 pt. However, msize(5.6) gives a better match to Windows Arial 12pt and this may relate to the arbitrary way the point size relates to character size - originally it was the size of the metal block on which each character was carved.

        Comment


        • #5
          Is there a way to use other fonts, for example Calibri?

          Comment


          • #6
            Please start a new topic when you are changing topics;

            the answer to your question is yes: go to preferences, then graph preferences and you will see a place to change the default font

            Comment


            • #7
              Thanks. Is there a keyword to get 12pt font in titles, legends, etc, or is it all trial and error as described in this sequence?

              Comment

              Working...
              X