GFONT Procedure

The Kern Data Set

Overview: The Kern Data Set

The kern data set consists of observations that specify how much space to add or remove between any two characters when they appear in combination. This process, called kerning, increases or decreases space between the characters. Kerning usually is applied to certain pairs of characters that have too much space between them. Reducing the space between characters might result in part of one character extending over the body of the next. Examples of some combinations that should be kerned are AT, AV, AW, TA, VA, and WA.
You can apply kerning to the intercharacter spacing that you specify with the CHARSPACETYPE= option (except for uniform fonts). Assign the kern data set with the KERNDATA= option.

Kern Data Set Variables

The kern data set must contain these variables:
CHAR1
specifies the first character in the pair to be kerned. CHAR1 is a character variable with a length of 1.
CHAR2
specifies the second character in the pair to be kerned. CHAR2 is a character variable with a length of 1.
XADJ
specifies the amount of space to add or remove between the two characters. XADJ is a numeric variable that uses the same font units as the font data set. The value of XADJ specifies the horizontal adjustment to be applied to CHAR2 whenever CHAR1 is followed immediately by CHAR2. Negative numbers decrease the spacing, and positive numbers increase the spacing.

Creating a Kern Data Set

Each observation in a kern data set names the pair of characters to be kerned and the amount of space to be added or deleted between them. To create a kern data set, follow these steps:
  1. Select the pairs of characters to be kerned, and specify the space adjustment (in font units) for each pair as a positive number (more space) or negative number (less space).
  2. Create a SAS data set that contains the variables CHAR1, CHAR2, and XADJ. Define one observation for each pair of characters and the corresponding space adjustment, for example:
    data kern1;
      input char1 $ char2 $ xadj;
      datalines;
    A T -4
    D A -3
    T A -4
    ;
  3. Assign the kern data set with the KERNDATA= option as follows:
    proc gfont data=fontdata
               name=font2
               charspacetype=data
               kerndata=kern1
               nodisplay;
    run;
Creating a Kern Data Set illustrates how to use the KERNDATA= option to create a font in which the space between specified pairs of letters is reduced. The characters A, D, and T are shown as the word DATA. The first line uses the unkerned font, FONT1, and the second line uses the kerned font, FONT2. Note that the characters in FONT2 are spaced more closely than the characters in FONT1.
The following TITLE statements specify the kerned and unkerned fonts and are used with the GSLIDE procedure to produce Comparison of Kerned and Unkerned Text.
title2 lspace=6 f=font1 h=10 j=l "DATA";
title3 lspace=4 f=font2 h=10 j=l "DATA";
Comparison of Kerned and Unkerned Text
Comparison of Kerned and Unkerned Text