Examples


The following examples illustrate major features of the GFONT procedure.

Example 1: Displaying Fonts and Character Codes

Procedure features:

  • GFONT statement options:

    • HEIGHT=

    • NOBUILD

    • ROMCOL=

    • ROMFONT=

    • ROMHT=

    • SHOWROMAN

Sample library member: GFODISFO

click to expand
Figure 32.12: Display of the Greek Font with Character Codes (GFODISFO)

This example illustrates the SHOWROMAN option, which displays the character codes that are associated with the font characters that are being displayed. A display such as this one shows which keyboard character you enter to produce the Greek character you want. In addition, this example shows how to modify the appearance of both the font characters and the character codes when they are displayed.

Set the graphics environment.

 goptions reset=global gunit=pct border cback=white           colors=(black blue green red)           ftext=swiss htitle=6 htext=3; 

Define title and footnote.

 title 'The GREEK Font with Character Codes';  footnote j=r 'GFODISFO '; 

Display the GREEK font with character codes. NOBUILD indicates that the font specified in the NAME = argument is an existing font. HEIGHT= specifies the height of the Greek characters. ROMCOL=, ROMFONT=, and ROMHT= assign the color , type style, and height of the character codes. SHOWROMAN displays the character codes.

 proc gfont name=greek             nobuild             height=3.7             romcol=red             romfont=swissl             romht=2.7             showroman;  run; quit; 

Example 2: Creating Figures for a Symbol Font

Procedure features:

  • GFONT statement options:

    • CTEXT=

    • DATA =

    • FILLED

    • NAME=

    • RESOL=

Other features:

  • LIBNAME statement

Sample library member: GFOCRFIG

click to expand
Figure 32.13: Display of Symbols For Characters

This example shows how to create three simple figures for a symbol font. Each figure is laid out on a grid that is 64 font units square. The third figure is a circle with a slash through it. Figure 32.14 on page 965 shows the figure and some of its coordinate points laid out on a grid.

click to expand
Figure 32.14: Diagram of Circle with Slash Figure

Assign the librefs and set the graphics environment. The LIBNAME statement associates the libref GFONT0 with the SAS data library in which the font catalog is stored.

 libname gfont0 '  SAS-data-library  ';  goptions reset=global gunit=pct border cback=white           colors=(black blue green red)           ftext=swiss htitle=6 htext=3; 

Create the font data set FIGURES for a triangle, a heart, and a circle with slash. The first figure, a right-pointing triangle that is assigned the character code A, is a polygon drawn with three straight lines.

 data figures;     input char $ ptype $ x y segment lp $;     datalines;  A    W    0    64   0    P  /* triangle pointing right */  A    V    4     4   1    P  A    V   60    32   1    P  A    V    4    60   1    P  A    V    4     4   1    P 

The second figure, a heart that is assigned the character code B, uses the PTYPE variable combination V-C-V to draw the arcs that make up the top of the heart. Each side requires two arcs. Since the arcs are continuous, the observation that marks the end of one arc is also the beginning of the next arc. The heart drawing begins at the bottom point and continues counterclockwise.

 B  W   0  64  0  P /* heart */  B  V  32   2  1  P  B  V  44  17  1  P  B  V  58  40  1  P  B  C  46  47  1  P  B  V  56  58  1  P  B  C  46  47  1  P  B  V  32  52  1  P  B  C  18  47  1  P  B  V   8  58  1  P  B  C  18  47  1  P  B  V   6  40  1  P  B  V  20  17  1  P  B  V  32   2  1  P 

The third figure, a circle with a slash through it that is assigned the character code C, is composed of three polygons: a circle and two empty arcs. An observation with missing values separates the observations defining each of the three polygons. The outer circle is defined by the first group of observations. The empty arcs are drawn with three continuous arcs using the PTYPE variable pattern V-C-V-C-V-C-V. The straight line that closes the arc is drawn automatically by the GFONT procedure in order to complete the polygon. Because all the polygons are part of one character, the continuous space they define is filled.

 C  W   0   64   0  P /* circle with slash */  C  V  32   64   1  P  C  C  32   32   1  P  C  V  64   32   1  P  C  C  32   32   1  P  C  V  32    0   1  P  C  C  32   32   1  P  C  V   0   32   1  P  C  C  32   32   1  P  C  V  32   64   1  P  C  V   .    .   1  P  C  V  12.4 18.1 1  P  C  C  32   32   1  P  C  V   8   32   1  P  C  C  32   32   1  P  C  V  32   56   1  P  C  C  32   32   1  P  C  V  45.9 51.6 1  P  C  V   .    .   1  P  C  V  51.6 45.9 1  P  C  C  32   32   1  P  C  V  56   32   1  P  C  C  32   32   1  P  C  V  32    8   1  P  C  C  32   32   1  P  C  V  18.1 12.4 1  P  ; 

Define the title and footnote.

 title 'A Font of Three Figures';  footnote j=r 'GFOCRFIG '; 

Generate and display the font FIGURES. The DATA= argument names the input data set that is used to generate the font. The NAME= argument names the font that the procedure generates and automatically stores it in the GFONT0 catalog. (Note that you do not need to specify GFONT0.) FILLED specifies a filled polygon font. CTEXT= specifies the color of the figures in the font display. The color specification is not stored with the font. RESOL= is set to 2 to improve the resolution of the lines. By default, the newly generated font is displayed (the NODISPLAY option is not used).

 proc gfont data=figures             name=figures             filled             height=.75in             ctext=red             showroman             romht=.5in             resol=2;  run;  quit; 



SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net