Varying Fonts on a Page

This example illustrates a simple font variation within a printout. The task is to print a line-data file having the first line of each page in bold-faced type and the rest in standard type. This requires controls for two fonts in the page definition.

The commands to select a single font for the page, as shown in Figure Data File Printed Using a Single Font, are as follows:

The FONT command contains two names: the local (STANDARD) name and the user-access (M101) name for the selected font.

PAGEDEF ABCD ;
  FONT STANDARD M101 ;
  PRINTLINE ;

Note: Fonts cannot be an FGID. Also, all page definitions require a PRINTLINE command.

Data File Printed Using a Single Font

Data File Printed Using a Single Font

The next command stream changes the font by incorporating a TRCREF command. Assume the data file to be formatted incorporates table reference characters (TRCs) as shown in Figure Font Change Using TRCREF Command.

PAGEDEF ABCD ;
  FONT STANDARD M101 ;     /*CREATING LOCAL FONT NAMES  */
  FONT BOLDFACE M102 ;
  PAGEFORMAT ABCD ;
    TRCREF 0                /*DEFINING THE TRC VALUES    */
           FONT STANDARD ;
    TRCREF 1
           FONT BOLDFACE ;
  PRINTLINE CHANNEL 1
            POSITION 1 IN 1 IN
            REPEAT 8 ;

Font Change Using TRCREF Command

Font Change Using TRCREF Command

The TRCs in the data cause the font switch to be made. The TRCREF command equates a TRC in the data file with the local name of a font specified in the FONT command. The FONT command also contains the user-access name for the font. See Character Length for PPFA Names for information on local names and user-access names. Because of the relationship among the user-access name, the local name, and the TRC number that is established in the page definition, the TRCs in the data can cause a font switch automatically.

You can specify fonts within a PRINTLINE command when the data file contains no TRCs. For example:

PAGEDEF ABCD ;
  FONT M101 ;
  FONT BOLDFACE M102 ;
    PRINTLINE CHANNEL 1              /*BOLDFACE LINE      */
              POSITION MARGIN  TOP
              FONT BOLDFACE ;
    PRINTLINE POSITION MARGIN NEXT   /*STANDARD-TYPE LINE */
              FONT M101
              REPEAT 7 ;

Assume the data file represented in the sample print in Figure Font Change Using FONT Commands and Subcommands is to be formatted by this page definition.

This command stream, based on a data file without TRCs, works on the principle that each line of output whose font you want to change from the font in the previous line must be controlled by a separate PRINTLINE command. The FONT subcommand of the PRINTLINE command names the font desired for that line. In this example, two PRINTLINE commands are used because one font change and two fonts are intended for the output. The user-access font names appear in the two FONT commands immediately below the PAGEDEF command and, optionally, a local name. M101 and M102 in the example are user-access names; BOLDFACE is a local name. Use the local name in the FONT subcommand of PRINTLINE if it is included in the corresponding FONT command, as is done for the first PRINTLINE command.

Font Change Using FONT Commands and Subcommands

Font Change Using FONT Commands and Subcommands

Changing fonts field by field is similar to changing them in PRINTLINEs. You map each field individually with a FIELD command; include a FONT subcommand in the FIELD command. If a font change is desired for a field, as with the FONT subcommand of a PRINTLINE command, the font must be previously named in a FONT command.

Two possible defaults apply in case you do not specify a font within a field. If the governing PRINTLINE has a FONT subcommand, it contains the font default for the field. If the governing PRINTLINE has no font specification, the print server assigns a font according to its default rules.