DiType User Guide/Supported Fonts

From Docs

Jump to: navigation, search

< DiType User Guide

Contents

Supported Fonts

This appendix lists font types currently supported in DiType, and describes the details of their use. The overall structure of font configuration is described in the DiType User Guide; here, details specific to particular font formats are described.

PostScript Type 1 Fonts

To use a Type 1 font with DiType, it is necessary to obtain an AFM (Adobe Font Metrics) file for the font, and to specify the URL to it in the afm attribute of the <font-data> element. If the font is to be embedded into the resulting PDF or PostScript documents, a font outline file in PFA or PFB format is also needed; its location is specified in the respective attribute of the <font-data> — either pfa or pfb. (SVG output doesn't support font embedding)

Example: suppose we have a metrics file mybar.afm and an outline file mybar.pfb. Its descriptor in the configuration file should look like this:
<font embed="true" subset="true">
    <font-data afm="mybar.afm" pfb="mybar.pfb"/>
</font>

If your Type 1 font uses non-standard glyph names, you may need an additional step — custom glyph list registration. This is discussed in more detail in the next section.

PostScript Fonts and Unicode

Type 1 font support in DiType is based on direct mapping of Unicode characters to glyph names. Built-in character codes are not used in the formatting.

DiType follows Adobe's guidelines for mapping Unicode values to glyph names, as described in the following document: Unicode and Glyph Names, version 2.3 ( http://partners.adobe.com/public/developer/opentype/index_glyph.html ). By default, Adobe Glyph List, version 2.0 (hereinafter, AGL; http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt ) is used to determine the Unicode positions for Type 1 glyphs; AGL is hard-coded inside DiType.

If a font includes only glyphs comprised in the AGL and all glyphs are named according to Adobe standards, you need no additional steps to use them in XEP. (This is normally the case with most Latin-based Type 1 fonts). However, some fonts cannot be covered by the AGL:

  • Some fonts define glyphs outside the scope of AGL — exotic scripts, custom dingbats, etc.
  • Some others give non-standard names to glyphs; e.g., Cyrillic or Armenian fonts from TeX.

With DiType, it is possible to use such fonts and to access characters from them by their regular Unicode values. All you need to do is to write an extension to the Adobe Glyph List, and register in the font descriptor: glyph-list attribute of a <font-data> element that contains a URL to the extension glyph list. Glyph lists are ascribed to fonts individually: different fonts in your system may use different glyph naming systems.

The syntax of a custom glyph list is as follows:

  • Lines starting with '#' are comments.
  • Empty lines are ignored.
  • Each non-comment and non-empty line contains information about a single glyph.
  • Within a line, records are separated by semicolons.
  • The first record is the Unicode value — 4 hex digits.
  • The second record is the glyph name as used in the AFM file.
  • The rest of the line is treated as a comment.

Note: The syntax for the glyph list follows the structure of the previous version of AGL, Adobe Glyph List 1.2 ( http://www.renderx.com/glyphlist-old.txt ). Unfortunately, the two versions of AGL are not compatible with each other.

Duplicate entries are allowed in glyph lists: you can assign different Unicode values to one and the same glyph, and have more than one glyph point to the same Unicode value.

In a custom glyph list, there is no need to cover all symbols present in the font: only non-standard mappings should be included. All glyphs not found in the glyph list are processed according to AGL 2.0 (hard-coded into the formatter).

Following is a schematic example of a custom glyph list:
# Sample Glyph List

0020;space
0021;exclam;EXCLAMATION MARK
…
…
…
A registration entry for a font with custom glyph mapping looks like this:
<font-data afm="mybar.afm"
           pfa="mybar.pfa"
           glyph-list="my.glyphs"/>

Standard Adobe Fonts

An important kind of Type1 fonts are Adobe standard font families: Times , Helvetica , Courier , Symbol , and ZapfDingbats. They are present in every PDF or PostScript installation, and do not require embedding. The default DiType configuration includes settings for them.

All symbols from these fonts are accessed by Unicode, including Symbol and ZapfDingbats fonts. For Symbol, mapping of Unicode to glyph names is contained in the Adobe Glyph List, version 2.0 ( http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt ). ForZapfDingbats, the mapping is taken from a separate document, also available at the Adobe technical support site: http://partners.adobe.com/public/developer/en/opentype/zapfdingbats.txt .

DiType samples include three files where all glyphs available from standard Adobe fonts are listed, with their Adobe glyph names and Unicode values:

  • adobe-standard.fo - lists all glyphs from Roman Extended character set.
  • symbol.fo - lists all glyphs from Symbol character set.
  • zapf-dingbats.fo - lists all glyphs from ZapfDingbats character set.

TrueType Fonts

TrueType fonts are supported in DiType, with the following limitations:

  • DiType can use only Unicode-enabled TrueType fonts, i.e., those with an internal cmap table for mapping glyph IDs to Unicode. Most TrueType fonts now satisfy this condition, but not all. A notable exception is Wingdings font, commonly found on Windows machines.
DiType supports only stand-alone TrueType fonts (normally stored in files with a *.ttf extension). Fonts in TrueType Collection files (they normally have a *.ttc extension) are not supported. To use a stand-alone TrueType font with DiType, a URL to its font file should be specified in a ttf attribute to the <font-data> element, as in the following example:
<font-data ttf="MYBAR.TTF"/>


Personal tools