# change-font(2)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

change-font - Change the screen font

## SYNOPSIS

[X-Windows]
change-font "fontName"

[IBM-PC / MS-DOS]
change-font "mode-no" "spec"

[Microsoft Windows]
n change-font "name" charSet weight width height

## DESCRIPTION

change-font is a platform specific command which allows the displayable font to be modified. The selection of font is determined by the monitor resolution and the capabilities of the graphics adapter.

This command is available on all systems except termcap. While MS-DOS does not support the concept of different fonts, it does (or at least the graphics card does) support the concept of changing screen resolution, which has the effect of changing the font. Each platform takes different arguments and are considered independently, as follows:

## X-Windows

The X-Windows UNIX environments accept a single argument which is a fully qualified font name. Simply give the font X name and the font will change if it is available. The window size changes to attempt to retain the same number of rows and columns so ensure that when changing to a larger font then there is enough room (or a way) to resize a window which is larger than the actual screen.

The X font string describes the attributes of the font in terms of it's size name etc. as follows:-

-foundry-family-weight-slant-width--pixels-point-hres-vres-space-av-set

Where

foundry

The type of foundry that digitized and supplied the font.

family

Font Family.

weight

Modifies the appearance of the font, the weight is usually medium or bold.

slant

Determines the orientation of the font. slant is usually roman (upright), italic or oblique.

width

Describes the proportionate width of the font. Typical widths include normal, condensed, narrow, double.

pixels

Pixel size of the font

point

The resolution of the font in tenths of a dpi (i.e. dpi*10)

hres

Horizontal resolution of the font in dpi.

vres

Vertical resolution of the font in dpi.

space

The spacing of the font. Typical spacing values include monospaced (i.e. fixed width), proportional and character cell.

av

Mean width of all font characters, measured in tenths of a pixel.

set

Character set - character set standards e.g. iso8859-1.

The default font used by MicroEmacs 2009 is

    -*-fixed-medium-r-normal--15-*-*-*-c-90-iso8859-1

A good font to try is:

    change-font "-misc-fixed-medium-r-normal--13-*-*-*-c-80-iso8859-1"

The font may also be changed in your .Xdefaults file by inserting the line:-

    MicroEmacs.font "-misc-fixed-medium-r-normal--13-*-*-*-c-80-iso8859-1"

## IBM-PC / MS-DOS

MS-DOS may only change the screen resolution, the standard screen resolution is either 80 columns by 25 rows or 80 by 50. A more advanced graphics card can typically support up to 132 by 60, MicroEmacs in theory has no limit but it has only been tested up to this size.

The main problem with MS-DOS machines is that there is no standard and this is no exception. The graphics mode needed to get a 132 by 60 screen (if available) varies from one card to the next so MicroEmacs 2009 needs to know the graphic mode number your card uses to get your required screen resolution.

MicroEmacs 2009 can also attempt a little bit of magic to double the number of rows on the screen for a given screen resolution. This is how 50 lines are obtained from the standard 25 line mode 3. If the value of "spec" is non-zero then this is attempted, to the authors knowledge this will either work or not depending on the direction of the wind and no harm will befall the users equipment. However the author also quickly disclaims anything and everything, the user uses this at their own peril, like everything else.

MicroEmacs 2009 attempts to determine the new screen width and depth itself, in case this fails the commands change-frame-width(2) and change-frame-depth(2) may be used to correct the problem.

Following are the standard MS-DOS text modes:

    change-font "2" "0"       ; Simple monochrome or EGA monitor, 80 by 25.
    change-font "3" "0"       ; Simple EGA/VGA monitor, again 80 by 25.
    change-font "3" "1"       ; Simple EGA/VGA monitor using spec, 80 by 50.

Most Trident cards support the following text mode:

    change-font "86" "0"      ; Sweet 132 by 60

A Diamond Stealth supports the following mode:

    change-font "85" "1"      ; Nice 132 by 50

Cirrus video cards (1MB) seem to support:

    change-font "84" "1"      ; PT-526 (132x50)

Time to start digging out your graphics card manual!

## Microsoft Windows

The Microsoft Windows environments utilize font files to drive the display. When change-font is invoked with no arguments, or a negative argument then a font dialog is presented to the user to allow the font to be selected. The current font is not changed if a negative argument is given, in both cases the variable $result(5) is set the the user selected font. The format of the returned string is "`OWwwwwhhhhhFontName`", where:-

O

The type of character set (0 for OEM and 1 for ANSI).

W

The font weight (0 - 9).

wwww

The font width.

hhhh

The font height.

FontName

The font name.

If a positive argument is specified with change-font then the arguments are explicitly entered, arguments are defined as follows:-

font

The name of the font - maximum of 32 characters. Select Fixed mono fonts only. Proportional fonts may be specified but the cursor will not align with the characters on the screen.

An empty name ("") may be specified resulting in the selection of the default system OEM font. No other arguments are required when specified.

Note that Courier New is not actually a fixed mono font as might be expected.

charSet

The type of character set required, this is an integer value of:-

`0` - ANSI or Western (True Type etc)
`161` - Greek
`162` - Turkish
`204` - Russian
`255` - OEM (or bitmapped)

weight

The weight of the font. The values are defined as:-

`0` - Don't care (Automatically selected).
`1` - Thin
`2` - Extra Light
`3` - Light
`4` - Normal
`5` - Medium
`6` - Semi-Bold
`7` - Bold
`8` - Extra-Bold
`9` - Heavy

Note that you may request a weight and it is not honored. Typically 4 and 7 are honored by most font definitions. 4 is typically used.

width

The width of the font. Specifies the average width, in logical units, of characters in the requested font. If this value is zero, the font mapper chooses a "closest match" value. The "closest match" value is determined by comparing the absolute values of the difference between the current device's aspect ratio and the digitized aspect ratio of available fonts.

Note that if the width is specified as zero then the height should be specified and the width will be automatically selected.

height

The height of the font. Specifies the desired height, in logical units, of the requested font's character cell or character. (The character height value is the character cell height value minus the internal-leading value.) If this value is greater than zero, the font mapper matches it against available character cell height values; if this value is zero, the font mapper uses a default height value when it searches for a match; if this value is less than zero, the font mapper matches it against available character height values.

Note: as with the weight the width and height may not be honored if the font cannot support the specified width/height in which case the closest matching height is automatically selected

## Notes on the Standard Windows Configuration

For releases prior to '99, the Terminal font is the standard MS-DOS font used for the MS-DOS window. This is an OEM fixed width character set which contains all of the conventional symbols found in the DOS shell.

Releases of MicroEmacs post '99 may utilise any of the windows fonts, typically `Courier New` or `Lucida Console` are used, these provide the best screen rendering of characters. `Lucida Console` is slightly better with a smaller font size as this allows a '`1`' (one) and '`l`' (lower case L) to be distinguished.

The Terminal fonts are the same as shown in the DOS window the last 2 arguments are the width x height, the terminal equivalents (Bit Mapped) are commented here.

7x12

Regular weight seems to offer the best resolution for 14/15" monitors.

6x8

Regular weight is more suitable for 17-21" monitors which offer better resolutions.

The best options for the fonts are defined as follows:-

    ;Standard Terminal Fonts - standard weight
    ;change-font "Terminal" 0 4  4  6
    change-font "Terminal" 0 4  6  8
    ;change-font "Terminal" 0 4  8  8
    ;change-font "Terminal" 0 4  5 12
    ;change-font "Terminal" 0 4  7 12
    ;change-font "Terminal" 0 4  8 12
    ;change-font "Terminal" 0 4 12 16
    ;change-font "Terminal" 0 4 10 18

    ;Standard Terminal Fonts - heavy weight
    ;change-font "Terminal" 0 7  4  6
    ;change-font "Terminal" 0 7  6  8
    ;change-font "Terminal" 0 7  8  8
    ;change-font "Terminal" 0 7  5 12
    ;change-font "Terminal" 0 7  7 12
    ;change-font "Terminal" 0 7  8 12
    ;change-font "Terminal" 0 7 12 16
    ;change-font "Terminal" 0 7 10 18

The "Courier New" font is not actually a fixed mono font as might be expected.

## SEE ALSO

change-frame-width(2), change-frame-depth(2), $result(5), user-setup(3).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>