www.delorie.com/gnu/docs/fontutils/fontu_58.html   search  
Buy GNU books!

Font utilities

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.2.3 char-width command

The char-width command specifies the set width and left side bearing as a percentage of the total remaining space for a single character. It has the form:

char-width charname width-expr , lsb-%-expr


is a character name from the font encoding. See section 9.3 Invoking Charspace, for how to specify the encoding file.

specifies the set width of the character in pixels. The set width is the sum of the bitmap width, left side bearing, and right side bearing.

specifies the left side bearing as a percentage of width-expr minus the bitmap width of the character. Expressing the lsb as a percentage means that you need not think about the width of the character image: if you want to center a character, for example, `.5' for lsb-%-expr will always work.

The char-width command is useful when you want a character to have a particular set width, since it's much simpler to specify that width and the left side bearing (and let the program compute the right side bearing) than to somehow estimate the bitmap width and then choose the side bearings to add up to the desired set width.

For example, in most fonts, the numerals all have the same width, to ease typesetting of columns of them in tables. Thus, `common.cmi' defines eight (the name for the numeral `8') as follows:

char-width eight numeral-width , eight-lsb-percent

Since the numeral width is traditionally one-half the em width of the font, `common.cmi' defines numeral-width as enspace, which in turn is defined to be half the quad fontdimen.

eight-lsb-percent is defined to be `.5', thus centering the `8'.

The other numerals are also defined to have width numeral-width, but the lsb-percents vary according to the character shapes.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003