FONTNAME (Font name) keyword in printer files

You use this file-level, record-level, or field-level keyword to specify the TrueType font name for printing named or constant fields within a record.

The format of the keyword is:

  FONTNAME('font-name-string' | &font-name-field
        (*POINTSIZE height-value | &height-value-field
        width-value | &width-value-field)
        [(*ROTATION rotation-value | &rotation-value-field)]
        [(*CODEPAGE [library-name/ | &library-name-field/]
        code-page-name | &code-page-name-field)]
        [(*IGCCODEPAGE [library-name/ | &library-name-field/]
        IGC-code-page-name | &IGC-code-page-name-field)])

When a program-to-system field is described for a FONTNAME parameter, the program-to-system field is allowed only when the keyword is used at the record or field level.

The font-name parameter is required. It can be up to 125 characters long.

You can specify the font-name as a constant string or as a program-to-system field, as shown in the following examples:

  • ('font-name-string'...
  • (&field1...

When you specify the font-name as a program-to-system field, the field must exist in the same record format as the FONTNAME keyword. It must be defined as data type A (character), usage P (program-to-system), and its length must not exceed 125 characters.

For additional information about TrueType and OpenType fonts and a list of the fonts included in IBM® i (installed with option 43 – Additional fonts), see TrueType and OpenType fonts.

Use the point-size parameter to further define a TrueType font, which requires a point size. Specify the point-size parameter as an expression of the form (*POINTSIZE height-value width-value). The height-value specifies the point size for the height of the font. The width-value specifies the point size for the width of the font. If the font is to be uniformly scaled (height and width the same), then you need specify the height value only. If you want to specify a width value, then you must also specify the height value. The valid values for the height and width parameters are 0.1 through 999.9.

If you omit the point-size parameter, unpredictable results occur when the file is printed.

You can specify the height-value and width-value as constants, as program-to-system fields, or as a combination of both, as shown in the following examples:

  • (*POINTSIZE height-value width-value)...
  • (*POINTSIZE &field1 &field2)...
  • (*POINTSIZE &field1 width-value)...
  • (*POINTSIZE height-value &field2)...

When you specify the height-value or width-value as a program-to-system field, the fields must exist in the same record format as the FONTNAME keyword. They must be defined as length 4 with one decimal position, data type S (zoned decimal), and usage P (program-to-system).

Use the optional rotation parameter to specify the clockwise rotation, in degrees, for the printed characters. Specify the rotation parameter as an expression of the form

[(*ROTATION rotation-value | &rotation-value-field)]

Valid values are integers 0, 90, 180, and 270. To achieve vertical printing of a field, specify a rotation value of 270 and also specify the field-level TXTRTT keyword.

You can specify the rotation value as a constant or as a program-to-system field, as shown in the following examples:

  • [(*ROTATION rotation)]...
  • [(*ROTATION &field1)]...

When you specify the rotation value as a program-to-system field, the field must exist in the same record format as the FONTNAME keyword. It must be defined as length 3, data type S (zoned decimal), and usage P (program-to-system).

Use the optional code-page-name parameter to print single-byte EBCDIC data with a TrueType font. If you do not specify either the optional code-page-name parameter or the optional igccode-page-name parameter, the print data must be Unicode-encoded. The code-page-name parameter can be up to eight characters in length. The single-byte code page must be a font resource (*FNTRSC) object with the code page (CDEPAG) attribute that reflects the encoding of the print data.

Use the optional library-name parameter to further qualify the code page. If library-name is not specified, *LIBL is used to search for the code page. If *LIBL is used, the system-supplied font libraries are added to the library list when searching for the requested code page.

Note: If an application uses private resources (for example, fonts, page segments, overlays, or GDF files not distributed with the system), be aware of the following information. When referencing these resources, if you specify *LIBL or you do not specify a library name, the resources must be available through the library list used by the application which created the spooled file.

The code page is validated at print time. An error message is issued if it is not valid.

You can specify the library name and code page name as constants or as program-to-system fields, as shown in the following examples:

  • [(*CODEPAGE [library-name/] code-page-name)]...
  • [(*CODEPAGE [library-name/] &field1)]...
  • [(*CODEPAGE [&field2/] code-page-name)]...
  • [(*CODEPAGE [&field2/] &field1)]...

When you specify the library name as a program-to-system field, the field must exist in the same record format as the FONTNAME keyword. It must be defined as length of 10, data type A (character), and usage P (program-to-system).

When you specify the code page name as a program-to-system field, the field must exist in the same record format as the FONTNAME keyword. It must be defined as length of 8, data type A (character), and usage P (program-to-system).

Use the optional igccode-page-name parameter to print double-byte EBCDIC data with a TrueType font. If you do not specify either the optional code-page-name parameter or the optional igccode-page-name parameter, the print data must be UCS-2 or UTF-16 encoded. The igccode-page-name parameter can be up to eight characters in length. The double-byte code page must be a font resource (*FNTRSC) object with the code page (CDEPAG) attribute that reflects the encoding of the print data.

Use the optional library-name parameter to further qualify the double-byte code page. If library-name is not specified, *LIBL is used to search for the double-byte code page. If *LIBL is used, the system-supplied font libraries are added to the library list when searching for the requested double-byte code page.

Note: If an application uses private resources (for example, fonts, page segments, overlays, or GDF files not distributed with the system), be aware of the following information. When referencing these resources, if you specify *LIBL or you do not specify a library name, the resources must be available through the library list used by the application which created the spooled file.

The double-byte code page is validated at print time. An error message is issued if it is not valid. You can specify the library name and double-byte code page name as constants or as program-to-system fields, as shown in the following examples:

  • [(*IGCCODEPAGE [library-name/] igccode-page-name)]...
  • [(*IGCCODEPAGE [library-name/] &field1)]...
  • [(*IGCCODEPAGE [&field2/] igccode-page-name)]...
  • [(*IGCCODEPAGE [&field2/] &field1)]...

When you specify the library name as a program-to-system field, the field must exist in the same record format as the FONTNAME keyword. It must be defined as length of 10, data type A (character), and usage P (program-to-system).

When you specify the double-byte code page name as a program-to-system field, the field must exist in the same record format as the FONTNAME keyword. It must be defined as length of 8, data type A (character), and usage P (program-to- system).

Note: When a printer file is created and a character set and code page are specified for the font character set (FNTCHRSET) parameter, column spacing is done using this printer file level parameter. Any fonts or code pages specified in the FONTNAME keyword are ignored and the font and code page specified in the printer file parameter FNTCHRSET is used.

Specify DEVTYPE(*AFPDS) on the CRTPRTF command when FONTNAME is specified in the file. If DEVTYPE is changed to anything other than *AFPDS, the keyword is ignored and a warning message is issued at print time.

FONTNAME with *CODEPAGE cannot be specified at the same level as the FONT, FNTCHRSET, or CDEFNT keyword, and it cannot be specified with the CCSID keyword.

FONTNAME with *IGCCODEPAGE cannot be specified at the same level as the IGCCDEFNT keyword and it cannot be specified with the CCSID keyword.

FONTNAME without *CODEPAGE or *IGCCODEPAGE cannot be specified at the same level as the FONT, FNTCHRSET, CDEFNT, or IGCCDEFNT keyword.

FONTNAME without *CODEPAGE or *IGCCODEPAGE can be specified only with the CCSID keyword (with the *NOCONVERT parameter). Use this combination to print Unicode data, using a field with data type G. If FONTNAME without *CODEPAGE or *IGCCODEPAGE is specified at the file level or record level, it is used to print the Unicode data, even if a FNTCHRSET keyword is used to specify an AFP Unicode migration font.

Option indicators are valid for this keyword.

Example

The following example shows how to specify the FONTNAME keyword.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A*
     A          R REC1                      FONTNAME('WT SansDuo' +
     A                                      (*POINTSIZE 15.1) +
     A                                      (*CODEPAGE USERLIB/CDP1))
     A*
     A            FLD1A         14G     3  8FONTNAME('WT Sans' +
     A                                      (*POINTSIZE 10.0))   +
     A                                      CCSID(13488 *NOCONVERT)
     A*
     A            FLD2A          6A     4  8FONTNAME('WT SansDuo' +
     A                                      (*POINTSIZE 99.9) +
     A                                      (*CODEPAGE USERLIB/&DATA1))
     A            DATA1          8A  P
     A*
     A            FLD3A         10G     5  8FONTNAME('WT Serif J' +
     A                                      (*POINTSIZE 5.0 3.0) +
     A                                      (*ROTATION 270) +
     A                                      (*IGCCODEPAGE +
     A                                       USERLIB/IGCCDP1))
     A*
     A            FLD4A         10O     7  8FONTNAME('WT Serif J' +
     A                                      (*POINTSIZE 7.0 5.0) +
     A                                      (*ROTATION 270) +
     A                                      (*CODEPAGE USERLIB/CDP2) +
     A                                      (*IGCCODEPAGE +
     A                                       USERLIB/IGCCDP2)) +
     A                                      TXTRTT(90)
     A*
     A            FLD5A          8A     8  8

FLD1A is printed using a TrueType font called WT Sans, with Unicode data, a CCSID of 13488, and a point size of 10.0.

FLD2A is printed using a TrueType font called WT SansDuo. It allows the application program to specify the code page name by setting the field &DATA1. The code page exists in library USERLIB. The point size is 99.9.

FLD3A is printed using a TrueType font called WT Serif J, a double-byte code page IGCCDP1, which exists in library USERLIB, a vertical point size of 5.0 and a horizontal point size of 3.0. The individual characters are rotated 270 degrees in a clockwise direction.

FLD4A is printed using a TrueType font called WT Serif J, code page CDP2, which exists in library USERLIB, double-byte code page IGCCDP2, which exists in library USERLIB, a vertical point size of 7.0 and a horizontal point size of 5.0. The individual characters are rotated 90 degrees in a clockwise direction. The text is also rotated 270 degrees, resulting in vertical printing.

FLD5A is printed using a TrueType font called WT SansDuo, code page CDP1, which exists in library USERLIB, and a point size of 15.1.