Chapter Contents

Previous

Next
The GFONT Procedure

PROC GFONT Statement


The PROC GFONT statement can either create user-defined fonts or display existing software fonts. Therefore, it names the font to be created or displayed. If the procedure creates a font it names the input data set. Optionally, the procedure modifies the design and appearance of the fonts that you create or display, and specifies a destination catalog for graphics output.


Syntax

PROC GFONT NAME=font-name
mode
<display-option(s)>
<creation-option(s)>;

For more detail on using the GFONT syntax, see Displaying Fonts: Required Arguments, Options and Creating Fonts: Required Arguments, Options .

Displaying Fonts: Required Arguments, Options



Required Arguments for Displaying Fonts

NAME=font-name
N=font-name
specifies the font to be displayed. Font-name can be the name of a SAS software font or a font you previously created.
See also: SAS/GRAPH Fonts

NOBUILD
NB
specifies that the GFONT procedure is to display an existing font. The NOBUILD argument tells the procedure that no font is being generated and not to look for an input data set.
Featured in: Displaying Fonts and Character Codes

To display a user-generated font, you must define libref GFONT0. See About the Libref GFONT0 for details.


Options for Displaying Fonts

Options that can be used for either font display or font creation are described here and in Options for Creating Fonts.

Options that display a font can be used when you create a font if you also display it (that is, the NODISPLAY option is not used 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.

When the syntax of an option includes units, use one of these:
CELLS character cells
CM centimeters
IN inches
PCT percentage of the graphics output area
PT points

If you omit units, a unit specification is searched for in this order:

  1. the value of GUNIT= in a GOPTIONS statement

  2. the default unit, CELLS.

CTEXT=text-color
CT=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:
  1. the CTEXT= option in a GOPTIONS statement

  2. the default, the first color in the colors list.

The CTEXT= value is not stored as part of the font.

Featured in: Creating Figures for a Symbol Font

GOUT=<libref.>output-catalog
specifies the SAS catalog in which to save the graphics output produced by the display of the font. The GOUT option is ignored if you use the NODISPLAY option in the PROC GFONT statement. 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 library called WORK and creates the catalog if it does not exist.
See also: Storing Graphics Output in SAS Catalogs

HEIGHT=character-height<units>
H=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. By default, HEIGHT=2.
Featured in: Displaying Fonts and Character Codes

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 the key map is asymmetrical, that is, 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 that only those characters that are mapped into your current key map are available (that is, those that are displayed when you display the font without the NOKEYMAP option).
See also: SAS/GRAPH Fonts The GKEYMAP Procedure and the NOKEYMAP option for Creating Fonts

NOROMAN
NR
turns off the automatic display of character codes that are produced when you use the SHOWROMAN option during font creation.

NOROMHEX
NOHEX
turns off the automatic display of hexadecimal values that are produced when you use the ROMHEX option during font creation.

REFCOL=reference-line-color
specifies a color for reference lines. By default, the first color in the colors list is used.

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. See Parts of a Font for an illustration of the placement of reference lines.

ROMCOL=code-color
RC=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:
  1. the CTEXT= option in a GOPTIONS statement

  2. the default, the first color in the colors list.

The ROMCOL= value is not stored as part of the font.
Featured in: Displaying Fonts and Character Codes

ROMFONT=font
RF=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:
  1. the FTEXT= option in a GOPTIONS statement

  2. the default hardware font, NONE.

Featured in: Displaying Fonts and Character Codes

ROMHEX
HEX
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 also can use the ROMHEX option when you create a font.
See also: the ROMHEX option

ROMHT=height<units>
RH=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:
  1. the HTEXT= option in a GOPTIONS statement

  2. the default, ROMHT=1.

Featured in: Displaying Fonts and Character Codes

SHOWALL
displays the font with a space for every possible character position whether or not 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, in which case all possible hexadecimal values are displayed. 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
SR
displays character codes below the font characters even if they are not displayed automatically with the font. If you use both the SHOWROMAN and ROMHEX options, both the character codes and the hexadecimal values are displayed. You can also use the SHOWROMAN option when you create a font.
See also: the SHOWROMAN option for Creating Fonts.
Featured in: Displaying Fonts and Character Codes


Details

To display a font, you must specify the name of the font with the NAME= argument and include the NOBUILD argument. For example, to display the Weather font with character codes that are displayed in the Swiss font, use the following statement:

proc gfont name=weather nobuild romfont=swiss;

Creating Fonts: Required Arguments, Options



Required Arguments for Creating Fonts

NAME=font-name
N=font-name
assigns a name to the font that you create. Font-name is the name of a catalog entry and must be a valid SAS name of no more than eight characters. Do not use the name of an Institute-supplied font or NONE for the name of a font.
Featured in: Creating Figures for a Symbol Font

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. By default, the procedure uses the most recently created data set as the font data set.
See also: SAS Data Sets
Featured in: Creating Figures for a Symbol Font

When you create a font, you must define the libref GFONT0. See About the Libref GFONT0 for details.

Note:   If a user-generated font has the same name as an Institute-supplied font and if the libref GFONT0 has been defined, the user-generated font is used because GFONT0 is searched first.  [cautionend]


Options for Creating Fonts

Options that can be used for either font display or font creation are described here and in Options for Displaying Fonts.

Options that display a font can be used when you create a font if you also display it (that is, the NODISPLAY option is not used 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.

When the syntax of an option includes units, use one of these:
CELLS character cells
CM centimeters
IN inches
PCT percentage of the graphics output area
PT points

If you omit units, a unit specification is searched for in this order:

  1. the value of GUNIT= in a GOPTIONS statement

  2. the default unit, CELLS.

BASELINE=y
B=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.

CAPLINE=y
C=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 Roman capitals. If you do not use the CAPLINE= option, the GFONT procedure uses the highest vertical coordinate in the font data set, in which case the capline and the font maximum are the same. See Parts of a Font for an illustration of capline and font maximum.

If you use the CAPLINE= option, then when the GFONT procedure calculates the height of a character, any parts of the character that project above the capline are ignored in the calculation.

You can use this option to prevent an accented capital like A from being shortened to accommodate the accent. For example, if you do not use the CAPLINE= option, the capline and the font maximum are the same and the A is shortened to make room for the accent below the capline. However, if CAPLINE= 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.

CHARSPACETYPE=DATA | FIXED | NONE | UNIFORM
CSP=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 The Font Data Set for details on the PTYPE variable.

Intercharacter spacing is included in the character's width. For example, if the first observation for the letter A specifies a character width of 10 units and the A itself occupies only 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.  [cautionend]

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 generate the character.

NONE
specifies that no space is added between characters. The width of the individual character is determined by the data that generate 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 rather than proportional. This means that each character occupies the same amount of space. For example, in uniform spacing the letters m and i occupy the same amount of space, whereas 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:

  • by default, the width of the widest character in the font.

  • the width specified by the MWIDTH= option. See the MWIDTH= option for details.

Specifying CHARSPACETYPE=UNIFORM is the same as using the UNIFORM option.

Note:    By default, CHARSPACETYPE=FIXED.  [cautionend]

CODELEN=1 | 2
specifies the length in bytes of the CHAR variable. By default, CODELEN=1. To specify double-byte character sets for languages such as Chinese, Japanese, or Korean, use CODELEN=2. If you specify a double-byte character set, you cannot specify kerning or space adjustment with the KERNDATA= or SPACEDATA= options.

FILLED
F
specifies that the characters in a user-generated polygon font are filled.
Featured in: Creating Figures for a Symbol Font

KERNDATA=kern-data-set
KERN=kern-data-set
specifies the SAS data set that contains kerning information. When the KERNDATA= option is used during font creation, the data that are contained in the kern data set are applied to the font and stored with it. You cannot specify kerning for a double-byte character set that is created by using the option CODELEN=2.
See also: The Kern Data Set

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 only valid when you specify uniform spacing by using the UNIFORM option or when you specify CHARSPACETYPE=UNIFORM. If you do not use MWIDTH=, the default is the width of the widest character in the font (usually the letter m).

Typically, you use the MWIDTH= option to tighten the spacing between characters. To do this, specify a smaller value (narrower width) 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

[IMAGE]

See also: the CHARSPACETYPE= option and the UNIFORM option

NODISPLAY
ND
specifies that the GFONT procedure is not to display the font that it is creating.

NOKEYMAP
specifies that the current key map is ignored when you generate and use the font that is being created, and that the character codes you enter are not mapped in any way before being displayed. As a result, the generated font is never affected by any setting of the KEYMAP= graphics option.
CAUTION:
Fonts generated with the NOKEYMAP option are never affected by any setting of the KEYMAP= graphics option.   [cautionend]

By default, the NOKEYMAP option is not used; in which case, when you build a font, the current key map is applied to the values in the CHAR variable.

However, your current key map may not be symmetrical; that is, two or more input character codes may 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, you can do one of the following:

When you use the NOKEYMAP option, your font 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 also: the NOKEYMAP option for Displaying Fonts and The GKEYMAP Procedure

RESOL=1...4
R=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 may 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

Featured in: Creating Figures for a Symbol Font

ROMHEX
HEX
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.
See also: the SHOWROMAN option, the ROMHEX option for Displaying Fonts, and the NOROMHEX option

SHOWROMAN
SR
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 you create, you can later use the NOROMAN option to suppress display of the character codes.
See also: the ROMHEX option, the SHOWROMAN option for Displaying Fonts, and the NOROMAN option

SPACEDATA=space-data-set
SPACE=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 are applied to the font and stored with it. You cannot specify space adjustment for a double-byte character set that is created by using the option CODELEN=2.
See also: The Space Data Set

UNIFORM
U
specifies that characters are spaced uniformly rather than proportionately. Using the UNIFORM option is the same as specifying CHARSPACETYPE=UNIFORM.
See also: the CHARSPACETYPE= option and the MWIDTH= option


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.