GFONT Procedure

PROC GFONT Statement

The PROC GFONT statement can either create SAS/GRAPH fonts or display existing SAS/GRAPH fonts. The GFONT procedure names the font to be created or displayed. If the GFONT procedure creates a font, then an input data set name is required. You can modify the design and appearance of the fonts that you create or display, and specify a destination catalog for graphics output.
Requirement: When you create or display a user-created font, you must define the libref GFONT0. See Storing or Displaying User-Created Fonts: GFONT0 Libref.

Syntax

The syntax for displaying a font is as follows:
PROC GFONT NAME=SAS/GRAPH-font | device-resident-font | system-font
NOBUILD <options-for-displaying-fonts>;
The syntax for creating a font is as follows:
PROC GFONT NAME=SAS/GRAPH-font
DATA= font-data-set <options-for-creating-fonts>;

Summary of Optional Arguments

Creating fonts
specifies the vertical coordinate in the font data set that is the baseline of the characters.
specifies the vertical coordinate in the font data set that is the capline of the characters.
specifies the type of intercharacter spacing.
specifies the length in bytes of the CHAR variable.
specifies that the characters in a polygon font are filled.
specifies the data set that contains kerning information.
specifies the width of a character in a uniform font, where character-width is the number of font units.
specifies that the GFONT procedure is not to display the font that it is creating.
specifies that the current key map is ignored when you create and then use the font that is created.
controls the resolution of the fonts by specifying the number of bytes (1 through 4) for storing coordinates in the font.
specifies that hexadecimal values display automatically below the font characters when the GFONT procedure displays the font.
specifies that character codes display automatically below the font characters when the GFONT procedure displays the font.
specifies the SAS data set that contains font spacing information.
specifies that characters are spaced uniformly rather than proportionately.
Displaying fonts
specifies a color for the body of the characters.
specifies the SAS catalog in which to save the graphics output generated by the display of the font.
specifies the height of the font characters in number of units, n.
specifies that the current key map is ignored when displaying the font and its character codes or hexadecimal values.
turns off the automatic display of character codes that are created when you use the SHOWROMAN option during font creation.
turns off the automatic display of hexadecimal values for single-byte characters.
specifies a color for reference lines.
draws reference lines around each displayed character.
specifies the color of the character codes or hexadecimal values that are displayed with the SHOWROMAN and ROMHEX options.
specifies the font for character codes and hexadecimal values that are displayed by the SHOWROMAN and ROMHEX options.
displays hexadecimal values below the font characters.
specifies the height of the character codes and the hexadecimal values that are displayed with the SHOWROMAN and ROMHEX options in number of units, n.
displays the font with a space for every possible character position whether a font character exists for that position.
displays character codes below the font characters even if they are not displayed automatically with the font.

Required Arguments

DATA=font-data-set
specifies the SAS data set that the GFONT procedure uses to build the font. The data set must be sorted by the variables CHAR and SEGMENT.
Default:The GFONT procedure uses the most recently created data set.
NAME=SAS/GRAPH–font | device–resident font | system–font
specifies font to be displayed. The name can be the name of a Name can be any of the following types of fonts:
  • SAS/GRAPH font that is stored in the SASHELP.FONTS catalog or or a SAS/GRAPH font created by the user and stored in a GFONTn catalog. These fonts can be used only by SAS/GRAPH procedures or other procedures that generate SAS/GRAPH output files.
  • system font that can be used by any SAS procedure and by other software, such as Microsoft Word. SAS/GRAPH installs and registers a set of TrueType fonts, and it is recommended that you use these fonts whenever possible.
  • device-resident font that is burned into the chips in a device's hardware. These fonts are specific to the device being used and are not portable between devices. Some device resident fonts such as Helvetica can also be present as system fonts.
Alias:N=
Note:Device resident font names must be enclosed in quotes.
NAME=SAS/GRAPH-font
assigns a name to the font that you create. SAS/GRAPH-font is the name of a catalog entry, and must be a valid SAS name of no more than eight characters. You cannot specify NONE, or the name of a SAS/GRAPH font that is shipped with SAS/GRAPH software.
NOBUILD
specifies that the GFONT procedure is to display an existing font. The NOBUILD argument tells the GFONT procedure that no font is being created and not to look for an input data set.

Options for Displaying Fonts

Options to display a font can be used when you create a font if you also display it (that is, you do not use the NODISPLAY option in the PROC GFONT statement). However, none of the display options affect the design and appearance of the stored font except the NOKEYMAP, SHOWROMAN, and ROMHEX options. See also Specifying Units for Creating Fonts.

CTEXT=text-color
specifies a color for the body of the characters. If you do not use the CTEXT= option, a color specification is searched for in the following order:
  • the CTEXT= option in the procedure statement
  • the CTEXT= option in a GOPTIONS statement
  • the color specified in the ODS style
  • the first color in the color list
Alias:CT=
Note:The CTEXT= value is not stored as part of the font.
GOUT=<libref.>output-catalog
specifies the SAS catalog in which to save the graphics output generated by the display of the font. You can use the GREPLAY procedure to view the output that is stored in the catalog.
If you omit the libref, SAS/GRAPH looks for the catalog in the temporary WORK library, and creates the catalog if it does not exist.
HEIGHT=character-height<units>
specifies the height of the font characters in number of units, n. Height is measured from the minimum font measurement to the capline.
Alias:H=
Default:2
NOKEYMAP
specifies that the current key map is ignored when displaying the font and its character codes or hexadecimal values. If you do not use the NOKEYMAP option when you display a font, the current key map remains in effect. If any characters in the font are not available through the current key map, they are not displayed and a warning is issued in the SAS log. This happens when not all characters in the font are mapped into the current key map.
Displaying a font using the NOKEYMAP option enables you to see all of the characters in the font, including those that are not mapped into your current key map.
Note:Only the characters that are mapped into your current key map are available.
NOROMAN
turns off the automatic display of character codes that are created when you use the SHOWROMAN option during font creation.
Alias:NR
NOROMHEX
turns off the automatic display of hexadecimal values for single-byte characters that are created when you use the ROMHEX option during font creation.
Alias:NOHEX
REFCOL=reference-line-color
specifies a color for reference lines. If you do not use the REFCOL= option, a color specification is searched for in the following order:
  • the CTEXT= option in a GOPTIONS statement
  • the color specified in the ODS style
  • the first color in the color list
REFLINES
draws reference lines around each displayed character. Vertical reference lines show the width of the character. Horizontal reference lines show the font maximum and the font minimum, as well as the baseline and the capline.
ROMCOL=code-color
specifies the color of the character codes or hexadecimal values that are displayed with the SHOWROMAN and ROMHEX options. If you do not use the ROMCOL= option, a color specification is searched for in the following order:
  • the color specified by the CTEXT= option in a GOPTIONS statement
  • the color specified in the current style or, if the NOGSTYLE option is specified, then the default color is black for the Java and Activex devices and the first color in the color list for all the other devices
Alias:RC=
Note:The ROMCOL= value is not stored as part of the font.
ROMFONT=font
specifies the font for character codes and hexadecimal values that are displayed by the SHOWROMAN and ROMHEX options. If you do not use the ROMFONT= option, a font specification is searched for in the following order:
  • the value of the ODS STYLE variable
  • the FTEXT= option in a GOPTIONS statement
  • fonts supplied by SAS
  • the device-resident font
ROMHEX
displays hexadecimal values below the font characters. If you use both the ROMHEX and SHOWROMAN options, both the character codes and the hexadecimal values are displayed. You can also use the ROMHEX option when you create a font.
Alias:HEX
See:ROMHEX (for creating fonts)
ROMHT=height<units>
specifies the height of the character codes and the hexadecimal values that are displayed with the SHOWROMAN and ROMHEX options in number of units, n. If you do not use the ROMHT= option, a height specification is searched for in the following order:
  • the HEIGHT specified in the ODS STYLE
  • the HTEXT= option in a GOPTIONS statement
Alias:RH=
Default:1
SHOWALL
displays the font with a space for every possible character position whether a font character exists for that position. The characters that are displayed are those available under your current key map, unless you use the NOKEYMAP option. The SHOWALL option usually is used in conjunction with the ROMHEX option, to display all possible hexadecimal values. If, under your current key map, a font character is available for a position, it displays above the hexadecimal value. If no character is available for a position, the space above the hexadecimal value is blank. You can use the SHOWALL option to show where undefined character positions fall in the font.
SHOWROMAN
displays character codes below the font characters even if they are not displayed automatically with the font. If you use both the SHOWROMAN option, and the ROMHEX option, both the character codes, and the hexadecimal values are displayed. You can also use the SHOWROMAN option when you create a font.

Options for Creating Fonts

Options to display a font can be used when you create a font if you also display it (that is, you do not use the NODISPLAY option in the PROC GFONT statement). However, none of the display options affect the design and appearance of the stored font except the NOKEYMAP, SHOWROMAN, and ROMHEX options. See also Specifying Units for Creating Fonts.

BASELINE=y
specifies the vertical coordinate in the font data set that is the baseline of the characters. The baseline is the line upon which the letters rest. If you do not use the BASELINE= option, the GFONT procedure uses the lowest vertical coordinate of the first character in the font data set.
Alias:B=
CAPLINE=y
specifies the vertical coordinate in the font data set that is the capline of the characters. The capline is the highest point of normal that case the capline, and the font maximum are the same. See Font Characteristics Terminology for an illustration of capline, and font maximum.
If you use the CAPLINE= option, when the height of a character is calculated, any part of the character that is above the capline is ignored in the calculation.
You can use this option to prevent an accented capital like A from being shortened to accommodate the accent. If you do not use the CAPLINE= option, the capline and the font maximum are the same. The A is shortened to make room for the accent below the capline. However, if the CAPLINE= option is used, the top of the letter A is at the capline, and the accent is drawn above the capline, and below the font maximum.
Alias:C=
CHARSPACETYPE=DATA | FIXED | NONE | UNIFORM
specifies the type of intercharacter spacing. The following are valid values:
DATA
specifies that the first observation for each character sets the width of that character. When CHARSPACETYPE=DATA, the PTYPE variable is required, and the observation that specifies the width of the character must have a PTYPE value of W. See Overview: The Font Data Set for details about the PTYPE variable.
Intercharacter spacing is included in the character's width. If the first observation for the letter A specifies a character width of 10 units, and the A occupies 8 units, the remaining 2 units serve as intercharacter spacing.
Note:The character can extend beyond the width that you specified in the first observation if desired.
FIXED
adds a fixed amount of space between characters based on the font size. The width of the individual character is determined by the data that generates the character.
NONE
specifies that no space is added between characters. The width of the individual character is determined by the data that generates the character. This type of spacing is useful for script fonts in which the characters should appear connected.
UNIFORM
specifies that the amount of space that is used for each character is uniform, not proportional. Each character occupies the same amount of space. In uniform spacing the letters m and i occupy the same amount of space, in proportional spacing m occupies more space than i. In uniform spacing, the character is always centered in the space, and a fixed space is added between characters.
When UNIFORM is specified, the amount of space that is used for each character is one of the following:
Alias:CSP=
Default: CHARSPACETYPE=FIXED
Note:Specifying CHARSPACETYPE=UNIFORM is the same as using the UNIFORM option.
CODELEN=1 | 2
specifies the length in bytes of the CHAR variable. To specify double-byte character sets for languages such as Chinese, Japanese, or Korean, use CODELEN=2.
FILLED
specifies that the characters in a polygon font are filled.
Alias:F
Default:1
Restriction:If you specify a double-byte character set, the KERNDATA= option and SPACEDATA= option are ignored.
KERNDATA=kern-data-set
specifies the data set that contains kerning information. When the KERNDATA= option is used during font creation, the data that is contained in the kern data set is applied and stored with the font.
Alias:KERN=
Restriction:If you specify kerning for a double-byte character set that is created by using the option CODELEN=2, then the KERNDATA= option is ignored.
MWIDTH=character-width
specifies the width of a character in a uniform font, where character-width is the number of font units. The MWIDTH= option is valid when you specify uniform spacing by using the UNIFORM option or when you specify CHARSPACETYPE=UNIFORM. If you omit the MWIDTH= option, the default is the width of the widest character in the font (usually the letter m).
The MWIDTH= option is typically used to tighten the spacing between characters. To do this, specify a smaller value for character-width. Using the MWIDTH= Option to Modify Spacing shows the effect of decreasing the space that is allowed for uniformly spaced characters.
Using the MWIDTH= Option to Modify Spacing
Using the MWIDTH= Option to Modify Spacing
NODISPLAY
specifies that the GFONT procedure is not to display the font that it is creating.
Alias:ND
NOKEYMAP
specifies that the current key map is ignored when you create and then use the font that is created. The character codes that you enter are not mapped in any way before being displayed. As a result, the created font is never affected by any setting of the KEYMAP= graphics option.
By default, the NOKEYMAP option is not used. In that case, when you build a font, the current key map is applied to the values in the CHAR variable.
However, your current key map might not be symmetrical; two or more input character codes might be mapped to the same output character. For example, if A is mapped to B, then both A and B map to B, but nothing maps to A. In this case, more than one code in your input data set can map to the same character in the resulting font. For example, if A and B are values of CHAR, both map to B. If this happens, a message that indicates the problem characters is displayed in the SAS log. To solve this problem, do one of the following tasks:
  • change the character code of one of the characters
  • eliminate one of the characters
  • use the NOKEYMAP option
The NOKEYMAP option works correctly only if the end user's host or controller encoding is the same as the encoding used to create the input data set.
See:NOKEYMAP (for displaying fonts)
CAUTION:
Fonts created with the NOKEYMAP option are never affected by any setting of the KEYMAP= graphics option.
RESOL=1...4
controls the resolution of the fonts by specifying the number of bytes (1 through 4) for storing coordinates in the font. The GFONT procedure provides three resolution levels (RESOL=3 produces the same resolution level as RESOL=4). By default, RESOL=1.
The higher the number, the closer together the points that define the character can be spaced. A high value specifies a denser set of points for each character so that the characters approximate smooth curved lines at very large sizes. RESOL=2 works well for most applications; RESOL=3 or 4 might be too dense to be practical.
The table below shows the resolution number and the maximum number of distinct points that can be defined horizontally or vertically.
Resolution
Number of Distinct Points
2
32,766
3
2,147,483,646
4
2,147,483,646
ROMHEX
specifies that hexadecimal values display automatically below the font characters when the GFONT procedure displays the font. If you use the ROMHEX option for a font that you create, you can later use the NOROMHEX option to suppress display of the hexadecimal values.
Alias:HEX
See:SHOWROMAN, ROMHEX (for displaying fonts), and NOROMHEX
SHOWROMAN
specifies that character codes display automatically below the font characters when the GFONT procedure displays the font. If you use the SHOWROMAN option for a font that you create, you can later use the NOROMAN option to suppress display of the character codes.
Alias:SR
See:ROMHEX, SHOWROMAN (for displaying fonts), and NOROMAN
SPACEDATA=space-data-set
specifies the SAS data set that contains font spacing information. When you use the SPACEDATA= option during font creation, the data contained in the space data set is applied to the font and stored with it.
Alias:SPACE=
Restriction:If you specify the SPACEDATA= option for a double-byte character set that is created by using the option CODELEN=2, then the SPACEDATA= option is ignored.
UNIFORM
specifies that characters are spaced uniformly rather than proportionately. Using the UNIFORM option is the same as specifying CHARSPACETYPE=UNIFORM.
Alias:U