# SETFONT **//SETFONT, height, face, pitch-family, \{charset, weight, style, rotation, width\}** SETFONT is used to select the printer font. If not used, the font will be determined by the FONT parameter within the printer initialization file. The last four parameters are optional, or may be specified as zero for defaults. Note that the color of the font will be black characters on a white transparent background, unless overridden by a [SETTEXTCOLOR](settextcolor.md) directive. See the topic [Parameters: Symbols vs. Values](parameterssymbolsvs.md) if you have questions about which to use. Also see the "Update Note" section at the bottom of this page. TIP: To change font in the middle of a line of text, use the backslash (\\) line terminator on the line prior to the font change in order to suppress the automatic line feed. For this and other tips, pointers and relevant information about writing GDI printing directives, please see [Writing GDI Print Directives](writinggdiprintdirectives.md). **Parameters** _height_ Height of the font in tenths of points. For example, use 120 to select a 12 point font. _face_ Face name of the font. These are the names that appear in the typical Windows font selection dialogs. Typical face names are Courier New, Helvetica, Fixed Sys, Times Roman, etc. _pitch-and-family_ Formed as the sum of the following: | **Symbol** | **Value** | **Description** | |------|------|------| | DEFAULT\_PITCH | 0 | Default pitch, don't care about family. | | FIXED\_PITCH | 1 | Fixed pitch (monospace). | | VARIABLE\_PITCH  | 2 | Variable pitch (proportional space). | | **Symbol** | **Value** | **Description** | |------|------|------| | FF\_DONTCARE | \&h000 | Don't care. | | FF\_ROMAN | \&h010 | Roman family (serifs, variable pitch)
Example: Times Roman. | | FF\_SWISS | \&h020 | Swiss family (sans serifs, variable pitch)
Example: MS Sans Serif. | | FF\_MODERN | \&h030 | Modern family (fixed pitch, serif or sans serif.) Examples: Courier, Pica, Elite. | | FF\_SCRIPT | \&h040 | Script family (look like handwriting.)
Examples: Script, Cursive | | FF\_DECORATIVE | \&h050 | Decorative family (novelty fonts.)
Example: Old English. | _charset_ Specifies the desired character set, from the following values: | **Symbol** | **Value** | **Description** | |------|------|------| | ANSI\_CHARSET | 0 | ANSI | | DEFAULT\_CHARSET | 1 | Don't care | | SYMBOL\_CHARSET | 2 | Symbols | | OEM\_CHARSET | 255 | OEM (system dependent) | _weight_ Specifies the desired boldness of stroke, from the following choices. Note that most of these are not supported but are mapped to the nearest supported choice. | **Symbol** | **Value** | **Description** | |------|------|------| | FW\_DONTCARE | 0 | Don't care | | FW\_THIN | 100 | Thin | | FW\_EXTRALIGHT | 200 | Extra Light | | FW\_LIGHT | 300 | Light | | FW\_NORMAL | 400 | Normal | | FW\_MEDIUM | 500 | Medium | | FW\_SEMIBOLD | 600 | Semibold, demibold | | FW\_BOLD | 700 | Bold | | FW\_EXTRABOLD | 800 | Extrabold, ultrabold | | FW\_HEAVY | 900 | Heavy | _style_ Specifies font style options. | **Symbol** | **Value** | **Description** | |------|------|------| | FS\_UPRIGHT | \&h00 | Normal upright | | FS\_ITALIC | \&h01 | Italic | | FS\_UNDERLINE | \&h02 | Underline | | FS\_STRIKEOUT | \&h04 | Strikeout | _rotation_ The default is zero. Rotation is specified in degrees, with positive numbers being rotated clockwise. _width_ This option allows you to stretch or squeeze the width of the font independent of the height. The units of _width_ are equivalent to that of _height_ (tenths of points). You may also use _width_ to specify the character width in terms of the number of characters that would fit on a line, by setting it to the negative of that value. For example, to select a font that would fit 90 characters across the page, set _width_ to -90. **Examples** //SETFONT,120,Arial This is 12 point Arial, standard options //SETFONT,100,Times Roman,0,0,200,1 This is 10 point Times Roman, extra light weight, italic //SETFONT,120,Courier,FIXED\_PITCH,ANSI\_CHARSET,FW\_EXTRABOLD,FS\_UPRIGHT This is 12 point Courier (or something similar in fixed pitch), extra bold, upright **Comments** In the context of fixed-pitch (mono-spaced) fonts, the terms "pitch" and "point" are sometimes confused or at least conflated by the traditional typewriter-era rule-of-thumb that a 12 point font (e.g. Courier, Pica) was equivalent to 10 pitch (10 CPI or characters per inch horizontal), while a 10 point font (e.g. Elite) was equivalent to 12 pitch. In the digital era, that rule-of-thumb falls apart, especially with proportional fonts, where the relationship between height in points and number of characters per inch is completely unpredictable, but even with fixed-pitch fonts, due to the fact that the characters can be made wider or thinner without changing the height. If it is important to select a font with a certain pitch (CPI), use the width parameter to specify it explicitly. Also note that while there is a natural relationship between the vertical line spacing (LPI or lines per inch vertical) and the font height (i.e. point size), changing the font does not automatically change the line spacing. See the GDI printing directive [RESETFONT](resetfont.md). **History** 2009 May, A-Shell build 1149: GDI printing bug fix/refinement: The width parameter in the SETFONT directive now works more precisely and reliably with fixed pitch fonts, across all font families, printers and resolutions. Previously, certain fonts (most notoriously Courier) didn't "behave" very well. And in addition, since the individual cell width was being rounded to the nearest integer number of pixels, small adjustments to the width were often not having the desired effect with lower printer device resolutions. Now, the cell width is interpolated to 1/8 of a pixel, resulting in fine control even with 100 DPI (e.g. fax) devices. Note that this update could possibly result in a small change in the horizontal character spacing of existing printouts. The change will probably be small, and will always represent a correction, but it is possible that having worked out precise spacing by trial-and-error, you may need to make adjustments after this fix. (After considerable soul-searching and public comment, we decided that since width is a relatively new parameter, rarely used, that the likelihood of this fix actually improving the spacing of existing reports was many times greater than the chance of it making a report worse. But if you use the width parameter to fine tune the fixed pitch spacing of a very precise form, and especially if you used trial-and-error rather than math to figure out the ideal width, you may need to take another look. (The upside is, anyone affected by this would have been at risk of their reports looking different on different printers; so even if you have to make an adjustment, the report will now print consistently across devices.) A more detailed discussion is available on the [A-Shell forum topic "Fixed Pitch Precision."](http://www.microsabio.net/bbs0719/ubbthreads.php?ubb=showflat&Number=609)