## Write

##### Web Browser, Text Mode and Command Line

If you click on [W] in the web browser or press [W] in the text mode interface or say `gms` `-w` respectively `gms` `/w` in the command line, then GMS will write the font map, a list of available fonts which is evaluated by GMS during initialisation of the format file, and later is used again by the TeX engine for typesetting. This font map, however, is only a by-product of a metrics computation process that may last several minutes, depending on computer speed and the number of fonts.

##### Glyphs

TeX comes from a time before PostScript `(PFA/PFB)` and TrueType `(TTF)` fonts were introduced. The TeX approach of typesetting is to place empty boxes accurately on the page, one box for every letter, and to leave it to the screen or printer driver to add the character shape information. So the TeX engine’s device-independent output file `(DVI)` could only be used on systems that already had installed the same fonts.

The pdfTeX extension written by Hàn Thế Thành enables TeX to embed all glyph data into a portable document, but the old TeX 3x kernel does not want to know what the glyphs look like; it still needs TeX font metric files `(TFM)` containing data about the letters’ heights, depths, and widths. Moreover, if an encoding `(ENC)` other than TeX’s proprietary `7`-bit code page is used, a virtual font file `(VF)` must be provided.

The font map keeps together the information about which files are related to any font. A typical entry looks like this: `_putr` `Utopia-Regular` `"` `CP1252-Encoding` `ReEncodeFont` `"` `<CP1252.enc` `<putr.pfb`, denoting 1. the base name of the font files (without leading underscore), 2. the PostScript font name mentioned in the font’s `AFM` file, 3. the PostScript encoding name (quoted), 4. the encoding file, and 5. the glyph file.

While encoding files can be found in `[GMS­_ROOT]/da­ta/enc`, font files are located in sub-directories of `[GMS­_ROOT]/fonts`. To minimize search time, `AFM` files (Adobe or PostScript font metrics), `PFA/PFB` (PostScript Type 1 glyph files), `TFM`, `TTF`, and `VF` files are kept in separate trees. Within every tree, typesetting systems following the TeX directory specificationTeX directory specification create one level of folders named after the type foundries and a second level named after the font families. There is, however, no technical need for this pedantry.

As reported in `fontmap.log``fontmap.log`, the GMS metric processor creates `TFM` and `VF` files from `AFM`, and `AFM` from `TTF` if necessary, running `ttf2afm`, `afm2tfm` and `vptovf` converters. In simple cases, if the GMS main encoding can be used that you have selected and if the PostScript font name must not be corrected, GMS will do this automatically; other­wise you have to modify three configuration files in `[GMS­_ROOT]/etc`: `font.cfg`, `encoding.cfg` and `alias.cfg`.

##### Fonts

Now let us have a closer look on how GMS was given access to certain fonts. Then you will be able to use your favorite fonts with Markup Shredder too:

• Bitstream Charter: Created folders `[GMS_­FONTS]­/afm­/bt­/char­ter` and `[GMS_­FONTS]­/type1­/bt­/char­ter`. Downloaded four AFM and four PFB files from CTAN into the corresponding directories. Shortened the base name of the font files from `bchr8a` to `bchr` etc. Opened `bchr.afm``bchr.afm` to find out the PostScript font name: CharterBT. Added `\add­FONT­alias` `Char­ter` `(Char­ter­BT)` to `alias.cfg`; so you can simply use the name `Char­ter` as HTML font-family name in markup documents.
• IBM Courier: As above, except that only two `AFM` and two `PFA` files are needed, for regular and bold weight, because the slanted variants can be computed by pdfTeX. Since Courier is a wide, non-proportional font, a narrower variant would be useful for technical doc­u­ments. To get this, four lines like `ncrr` `%GMS­_CODE­PAGE%` `embed` `0.75` `0.25` `ncrrco` had to be added to `font.cfg`, defining four type­faces which were grouped to a font-family named Cour­ier­Nar­row by saying `\add­FONT­family` `Courier­Narrow` `(ncrrc,` `ncrrco,` `ncrbc,` `ncrbco)` and `\add­FONT­alias` `Cour­ier­Nar­row` `(IBMCou­rier)` in `alias.cfg`.
• Monotype Arial: This font is among those `TTF` files that GMS setup copies from `%win­dir%\Fonts` to `%GMS­_ROOT%\fonts\ttf` to access standard TrueType fonts on Windows 32. You can use this font as ArialMT in HTML documents, or as Arial, because `\add­FONT­alias` `Arial` `(Arial­MT)` and `\add­FONT­fam­std` `Arial` `(arial)` were added to `alias.cfg`. The `\add­FONTfam­std` command corrects irregularities in the PostScript font naming, as you can see in `font.map`: The italic font face is named Arial-Italic­MT instead of Arial­MT-Italic, for example.
By default, metrics are processed only for the GMS main encoding that you have selected; GMS setup proposes `CP1252` (West Europe, Africa, America, Australia). The Monotype Arial font files, however, contain data for several hundred characters, cover­ing the windows-125x or `(CP125x)` code page series.
To access Cyrillic letters from Unicode page U+0400, the line `arial` `G0400` `embed­family` `1.0` `0.0` `none` `04` was added to `font.cfg`, and `\add­FONT­fam­uni` `Arial` `(arial` `04)` to `alias.cfg`. Alternatively, to support the Cyrillic code page windows-1251, the line `arial` `CP1251` `embed­family` `1.0` `0.0` `none` `W1` was added to `font.cfg`, and `\add­FONT­fam­ily` `Arial­Cyril­lic` `(arial­W1,` `arial­i­W1,` `arial­bd­W1,` `arial­bi­W1)` to `alias.cfg`. Here you have to use the font-family name Arial­Cyril­lic in HTML documents. In the `<head>` element, write `<meta` `http-equiv` `=` `"content-type"` `content` `=` `"text/html;` `charset=windows-1251"` `/>`. You can, however, leave the GMS main encoding set to `CP1252`.
• Monotype Andalus: This is one of the fonts that come with Windows XP but may be uninstalled. In such a case, insert the system CD and say: `expand` `X:\i386\and­lso.tt_` `%win­dir%\Fonts\and­lso.ttf` in the command line, where you have to replace `X` with your CD-ROM drive letter. GMS comes with a script to extract all XP fonts, just enter `%GMS­_ROOT%\batch\xp­fonts` `X:\i386` `%win­dir%\Fonts`.
This Arabic font, which only contains the ASCII subset of Latin letters, should not be processed with code page `CP1252` (West Europe), if this is the GMS main encoding. Therefore, the line `andlso:` `Ara­bic­MT` was added to `encoding.cfg`.
The encoding file `Ara­bic­MT.enc` is the same as `cp­1256.enc``cp­1256.enc` (Arabic), except that it uses Monotype glyph names which differ from the GMS glyph list, which is a compromise on the Adobe and Windows glyph lists.
• Shusha: This font, downloaded from Geo­Cities to `[GMS­_ROOT]/fonts/ttf/pub/shu­sha`, uses glyph names from the Latin code page `cp­1252.enc``cp­1252.enc`, but replaces them with the corresponding Hindi or Marathi letters. No changes had to be done to the configuration files to access this font with GMS, but you still may have to copy `shu­sha.ttf` to `%win­dir%\fonts`, if you want to use it on Windows with your browser.
• Courier, Helvetica, Times, Symbol, Zapf­Ding­bats: As you can see in `font.map`, these core fonts must not be embedded in the PDF document, because the corresponding glyph files are present on every installation of Acrobat Reader. With core fonts, you can produce very small PDF files for the internet, if you are mainly using letters from code page `CP1252` (West Europe). Symbol and ZapfDingbats need font-specific encoding `(``psy.enc` and `pzd.enc``)`.
• Computer Modern: The traditional TeX `7`-bit fonts designed by Donald Ervin Knuth are excluded from the GMS metric processing. GMS comes with the required `TFM` files and a separate map file named `cm.map`.

After re-computing of font metrics and re-writing of the `font map`, you still have to re-initialize the TeX format file for Markup Shredder.

If a TeX font metric file (`TFM`) is corrupted, pdfTeX may give you the following error message: `!` `Font` `=_GENR` `at` `12pt` `not` `loadable:` `Bad` `metric` `(TFM)` `file` `...` `line` `666.` `I` `wasn't` `able` `to` `read` `the` `size` `data` `for` `this` `font,` `so` `I` `will` `ignore` `the` `font` `specification.` This error should disappear if font metrics are re-processed; otherwise, you have to remove the corresponding font face from your document and `font.map`.