Figure 13-1: PDF Fonts

Portfolio Categories: All Graphics and SGR Book Graphics.

R Graphics Demo of PDF Fonts

R Graphics Demonstration of Built-in PDF Fonts

 
# PDF fonts - single file
# This code prints out the set of built-in PDF fonts

pdf(file = "illustrations/fig-13-1-PDF-fonts.pdf", 
  family = "Palatino",                 # Set default font to Palatino
  paper = "letter")                    # Set paper size

plot.new()                             # Start new plot
text(x = .5, y = .8,                   # Add text in the middle of the plot
  "AvantGarde",                        # Text to print 
  family = "AvantGarde",               # Use AvantGarde font
  cex = 2)                             # Set fontsize to 2

text(x = .5, y = .7,                   # Add text in the middle of the plot
  "Bookman",                           # Text to print 
  family = "Bookman",                  # Use Bookman font
  cex = 2)                             # Set fontsize to 2

text(x = .5, y = .6,                   # Add text in the middle of the plot
  "Courier",                           # Text to print 
  family = "Courier",                  # Use Courier font
  cex = 2)                             # Set fontsize to 2

text(x = .5, y = .5,                   # Add text in the middle of the plot
  "Helvetica",                         # Text to print 
  family = "Helvetica",                # Use Helvetica font
  cex = 2)                             # Set fontsize to 2

text(x = .5, y = .4,                   # Add text in the middle of the plot
  "Helvetica-Narrow",                  # Text to print 
  family = "Helvetica-Narrow",         # Use Helvetica-Narrow font
  cex = 2)                             # Set fontsize to 2

text(x = .5, y = .3,                   # Add text in the middle of the plot
  "NewCenturySchoolbook",              # Text to print 
  family = "NewCenturySchoolbook",     # Use NewCenturySchoolbook font
  cex = 2)                             # Set fontsize to 2

text(x = .5, y = .2,                   # Add text in the middle of the plot
  "Palatino",                          # Text to print 
  family = "Palatino",                 # Use Palatino font
  cex = 2)                             # Set fontsize to 2

text(x = .5, y = .1,                   # Add text in the middle of the plot
  "Times",                             # Text to print 
  family = "Times",                    # Use Times font
  cex = 2)                             # Set fontsize to 2

dev.off()                              # Output and close device