Fonts

This chapter explains about the fonts which AH Formatter V6.5 supports and how to use them. Also it explains the general consideration for each type of font. These are mainly for the non-Windows version. In the Windows version, the installed fonts are used as is without further effort.

The Font Configuration File is for setting the details of the font environment. In non-Windows version: Although the initial file is prepared, you need to set it in accordance with your font environment. In the Windows version: The font configuration file may be used as is.

AH Formatter V6.5 also supports EUDC, (end user defined character) for Private Use Characters.

See also Font Output in the PDF Output.
See also Font Output in the PostScript® Output.
See also Fonts in the INX Output.
See also Font Output in the XPS Output.

Supported font formats

AH Formatter V6.5 supports the following types of fonts.

CAUTION: When different types of fonts with the same file name or the same font family name exist in the same directory, it is indefinite which one is adopted. Also there is a possibility to interfere with the operation. Please avoid such a mixture.

Font Configuration File

To configure the font environment for AH Formatter V6.5, you must make a Font Configuration File.

The Font Configuration File is a simple structured XML file and is usually located in the [Install directory]/etc on non-Windows and [Install directory] on Windows.

The Font Configuration File should be set in the Environment Variables . The name font-config.xml is set as default.

In the Font Configuration File, the most important element is <font-folder>. If you want to use more than the PDF Standard 14 Fonts on non-Windows, you must locate the font files in the some directory and add the <font-folder path="..."> element to the configuration file.

AH Formatter V6.5 automatically detects the font files in the specified directory at the <font-folder path="...">. However, there are a few cases where the font name cannot be resolved, only in such cases it is necessary to describe the font file. Normally it is not necessary to specify each file to be used.

In Windows version, all fonts installed in the Windows font directory are always available to use. AH Formatter V6.5 reads the information on the fonts available to use when starting up AH Formatter. In other words, the more the fonts exist, the more processing time is taken. This means that it may take more time to initialize fonts than time to format when formatting a small document. With a big document, the time to initialize font may not be significant. In order to save the time to initialize fonts, reduce the available fonts. There are the following three solutions available:

  1. Reduce the font installed in the Windows font directory.
  2. In the Font Configuration File, enumerate fonts that are not used in the Windows font directory by using the font-exclude attribute.
  3. Prepare the separate directory where only necessary fonts are included and specify only that directory in the Font Configuration File.

A realistic solution may probably be 3. For example, put fonts you'd like to use in the directory of C:\MyFonts and prepare the Font Configuration File like the following:

<?xml version="1.0" encoding="UTF-8" ?>
<font-config windows-registry="disable">
  <font-folder path="C:\MyFonts"/>
</font-config>

Please be sure not to include the setting of Windows font directory here. Specify this Font Configuration File by the Environment Variables .

In Macintosh version, the system font directory is also included in the Initial Font Configuration File. If necessary, adjust the Font Configuration File as well.

Initial Font Configuration File

The following is the initial Font Configuration File. After you have finished the installation of AH Formatter V6.5 non-Windows version, this file will be located at [Install directory]/etc.

<?xml version="1.0" encoding="UTF-8" ?>
<!-- DOCTYPE font-config SYSTEM "font-config.dtd" -->
<font-config otf-metrics-mode="typographic">
  <!-- add your font folder here -->
  <!-- font-folder path="/home/user-name/fonts" -->
  <!-- /font-folder -->
  <font-folder path="[Install directory]/fonts">
    <font-entry file="ZapfDingbats.afm"
          glyph-list="ZapfDingbats-glyphname.txt"/>
  </font-folder>
</font-config>

In AH Formatter V6.5 Windows version, the following Font Configuration File is installed on [Install directory]. The Windows font directory is set to [System font directory].

<?xml version="1.0" encoding="UTF-8" ?>
<!-- DOCTYPE font-config SYSTEM "font-config.dtd" -->
<font-config
    otf-metrics-mode="typographic">
  <!-- add your font folder here -->
  <font-folder path="[System font directory]">
  </font-folder>
</font-config>

In Windows version, when there is no Font Configuration File, the Font Configuration File of this content will be assumed.

Font Configuration File elements and attributes

The following table is a summary of the elements and attributes in the Font Configuration File.

Element Location Attribute Default Description
<font-config> root element otf-metrics-mode typographic

Specify the method to evaluate font metrics information of TrueType and OpenType font.

  • "windows": use conventional method that is adopted until V4.2.
  • "typographic": use the new method.

If the attribute is omitted or empty, "windows" is assumed. Also, if use-windows-api="true" is specified in Option Setting File, "typographic" is assumed.

The conventional evaluation method until V4.2 has defect that commonly used Japanese font such as Ryumin is displayed lower position. The new method resolved this defect, but there is baseline positioning difference between new and old method. If you use CJK and Latin fonts together, new method influences line-height. If you want to avoid incompatibility with conventional version, specify "windows".

use-preferred-family true

Specifies whether the information on NameID=16 is used for a font family name with TrueType or OpenType.

windows-registry enable

Effective only with Windows version. Specifies whether to get the information of EUDC from the Windows registry or not. If the value is "enable", it refers to the registry. If the value is "disable", it doesn't.

<font-folder> child of <font-config> path

Indicates the font folder using the "path" attribute.

<font-folder path="/home/user-name/fonts">
  ....
</font-folder>

This element can be specified as many times as necessary.

recursive false If true is specified, inside of the subfolder included in the folder specified by path will also be searched.
<font-entry> child of <font-folder> file

Associated attributes are given to the font file specified by the "file" attribute (base file name, without the wild card).

glyph-list

Specifies the glyph-list file of the font when the Type1 font is specified by the "file" attribute. The glyph-list defines Unicode to glyph-name mapping rule for Type1 fonts.

skip-glyphname-mapping true

Specifies whether to map Unicode to the glyph name or map Unicode to the character-code of the font when the Type1 font is specified by the "file" attribute. If "true" is specified, it maps. If "true" is specified, it doesn't.

font-exclude false

Specifies whether to disregard the file specified by "File" attribute. If "true" is specified, it disregards. If "false" is specified, it doesn't. When "true" is specified, the font file is not processed.

unicode-range

Specifies the range of Unicode applied to the file specified by the "file" attribute. The setting can be done by the following format.

<urange>{, <urange>}*

<urange> is a hexadecimal number with the preceding "U+" and one of the followings. Case insensitive.

  • a single code point (e.g. U+416)
  • an interval value range (e.g. U+400-4FF)
  • a range where trailing "?" character implies "any digit value" (e.g. U+4??)

U+4?? is equivalent to U+400-4FF. U+??? is equivalent to U+000-FFF. Unicode up to U+10FFFF is effective. Even if a range greater than U+10FFFF is specified, it is disregarded. When unicode-range is not specified, it is considered as total range U+0-10FFFF.

font-size-adjust 1

Adjusts the fontsize of the file specified by the "file" attribute. For instance, when specifying font-size-adjust="1.05", the output size is 1.05 times greater than the size specified in FO. It is also possible to specify it as "105%" using the % value.

baseline-adjust 0

Adjusts the baseline of the file specified by the "file" attribute. For instance, when specifying baseline-adjust="0.1", the value is added to the baseline specified in FO and adjusted to the added position. It is also possible to specify it as "10%" using the % value.

<font-alias> child of <font-folder> file

Indicates the alias name of the font family name. The source font file should be specified using the "file" and "entry" attributes. "file" attribute should specify font files (base file name, without the wild card). For Type1 fonts, specify the font files that have the .AFM or .PFM extensions. For TrueType or OpenType fonts, you can specify the font files that have the .TTF or .TTC or .OTF extensions. The "entry" attributes should be the number of the fonts in the .TTC (TrueType Collection) file. The number should be a numeric value of 1 or more. If the "entry" attribute is omitted, the value is considered as 1. If the font is not .TTC, the value is ignored.

<font-alias file="simsun.ttc" entry="1">
  ....
</font-alias>

To define the alias names, enumerates the <alias> element within this element. This element can be specified as many times as necessary.

entry
<alias> child of <font-alias> family-name

Indicates the actual alias name for the font described in the "font-alias" element. The alias information is specified using "family-name", "weight", "italic" attributes. "family-name" attribute is the alias font family-name. Newly defined names should not match any other existing font-family names. "weight" attribute is the alias font weight class. This attribute can be specified using a numeric value between "100" and "900" or the keyword "normal", "bold". "italic" attribute indicates the font-style for italic. It should be specified using the keyword "true" or "false". You can specify multiple alias definition for one font file. This element can be specified as often as necessary.

It's possible to display the font file specified by <font-alias file> using the name and style specified here.

<font-alias file="ARIALI.TTF">
  <alias family-name="MyArial"/>
</font-alias>
<font-alias file="ARIALBI.TTF">
  <alias family-name="MyArial" weight="bold"/>
</font-alias>

In the example above, font-family="MyArial" font-weight="normal" should display "ARIALI.TTF", font-family="MyArial" font-weight="bold" should display "ARIALBI.TTF" differently. Please note the following points.

  • When the italic font is originally specified, and even if font-style="normal" is specified, it doesn't become normal.
  • When the bold font is originally specified, and even if font-weight="normal" is specified, it doesn't become normal. Even if font-weight="bold" is specified, it doesn't become bolder.

When <alias> is specified, the file set in <font-alias file> is selected by the name and style and displayed. For instance, when font-style="italic" is specified and there is no <alias> with italic setting, normal is adopted.

weight normal
italic false
<eudc-processing> child of <font-config> mapping enable

Specifies whether to process EUDC. If the "mapping" attribute is "enable", it processes EUDC. IF the "mapping" attribute is "disable", it doesn't.

<eudc-range> child of <eudc-processing> start

Specifies the range of EUDC by Unicode.

<eudc-range start="57344" end="63743"/>

Numeric value is specified. This sample indicates as 57344 = U+E000, 63743 = U+F8FF. If there is no numeric value specified, and the registry reference is effective with Windows version, it follows the instruction of the registry. If not, the PUA range is detected as (U+E000 to U+F8FF). When end is omitted, it is considered the same value as start. Multiple ranges can also be specified.

end
<eudc-system-default> child of <eudc-processing> file-path

Specifies the EUDC font file of the system default. It is adopted when there is no supported glyphs in the specified EUDC font. If there is no EUDC font file specified, and the registry reference is effective with Windows version, it follows the registry setting. At that time, the code page 932 is referred. If not, EUDC font of the system default is detected as nothing.

<eudc-map> child of <eudc-processing> family-name

Specifies the EUDC file by the "file-path" attribute, which is used when the character code of the EUDC range is specified to the font specified by the "family-name" attribute. If the registry reference is effective with Windows version, it is also taken into consideration. If there are the same "font-family" specified, the previous appearance takes precedence and the Font Configuration File takes precedence over the registry. This element can be specified as often as necessary.

file-path

The DTD of Font Configuration File is as follows:

<!ELEMENT font-config (font-folder+, eudc-processing?)>
<!ATTLIST font-config otf-metrics-mode     (windows|typographic)  "typographic">
<!ATTLIST font-config use-preferred-family (true|false)           "true">
<!ATTLIST font-config windows-registry     (enable|disable)       "enable">

<!ELEMENT font-folder (font-entry | font-alias)*>
<!ATTLIST font-folder path CDATA #REQUIRED>
<!ATTLIST font-folder recursive (true|false) "false">

<!ELEMENT font-entry EMPTY>
<!ATTLIST font-entry file                   CDATA #REQUIRED>
<!ATTLIST font-entry glyph-list             CDATA #IMPLIED>
<!ATTLIST font-entry skip-glyphname-mapping (true|false) "false">
<!ATTLIST font-entry font-exclude           (true|false) "false">
<!ATTLIST font-entry unicode-range          CDATA "U+0-10FFFF">
<!ATTLIST font-entry font-size-adjust       CDATA "1.0">
<!ATTLIST font-entry baseline-adjust        CDATA "0.0">

<!ELEMENT font-alias (alias)*>
<!ATTLIST font-alias file  CDATA #REQUIRED>
<!ATTLIST font-alias entry CDATA #IMPLIED>

<!ELEMENT alias EMPTY>
<!ATTLIST alias family-name CDATA #REQUIRED>
<!ATTLIST alias weight (normal|bold|100|200|300|400|500|600|700|800|900) #IMPLIED>
<!ATTLIST alias italic (true|false) #IMPLIED>

<!ELEMENT eudc-processing (eudc-range?, eudc-system-default?, eudc-map*)>
<!ATTLIST eudc-processing mapping (enable|disable) #IMPLIED>

<!ELEMENT eudc-range EMPTY>
<!ATTLIST eudc-range start CDATA #REQUIRED>
<!ATTLIST eudc-range end   CDATA #REQUIRED>

<!ELEMENT eudc-system-default EMPTY>
<!ATTLIST eudc-system-default file-path CDATA #REQUIRED>

<!ELEMENT eudc-map EMPTY>
<!ATTLIST eudc-map family-name CDATA #REQUIRED>
<!ATTLIST eudc-map file-path   CDATA #REQUIRED>

Adobe Type1 font

This section describes general information for Adobe Type1 fonts and how AH Formatter V6.5 supports them.

Font organization and necessary condition

Adobe Type1 fonts are organized using the following font files.

File extension Description
.PFB (Printer Font Binary) Contains binary compressed font outline.
.AFM (Adobe Font Metrics) Contains general font information and font metrics information. This is a text file. Mainly used in UNIX with .AFM+.PFB pairs.
.PFM (Printer Font Metrics) Contains general font information and font metrics information. It also specifies the Windows font menu name. This is a binary format file. Mainly used in Windows with .PFM+.PFB pairs.

AH Formatter V6.5 supports both types of combinations: .AFM+.PFB, .PFM+.PFB files.

Type1 font considerations.

  • The current version of AH Formatter V6.5 does not support font outline files with .PFA (Printer Font ASCII) extension. Most Type1 font products are shipped in the .PFB format, which is supported by AH Formatter V6.5.
  • Type1 font metrics data which has the .MMM extension is not supported. This metrics file is used for the Multiple Master Type1 fonts.
  • Both.PFB and .PFM that maps to .PFB must exist in the same directory. Fonts may be installed in different directories by using ATM (Adobe Type Manager). Such fonts cannot be used for embedding with AH Formatter V6.5.

How to use Adobe Type1 fonts

If you want to use Adobe Type1 fonts, simply specify the font-family, font-weight and font-style property in the FO. The following FO example uses Helvetica for the fo:block.

<fo:block font-family="Helvetica" font-weight="bold" font-style="italic">
  Helvetica (Bold-Italic) will be applied to this text.
</fo:block>

Embedding Adobe Type1 fonts

AH Formatter V6.5 supports embedding the Type1 font into PDF files. The followings are required to embed fonts:

  • The .AFM+.PFB or .PFM+.PFB font files must be in the folder specified in the <font-folder> of the font configuration file.
  • In the Option Setting File specify the target font family name <embed-font> element or specify <pdf-settings embed-all-fonts="true"> entry.

If you do not embed fonts, only .AFM or .PFM files are needed. If fonts are not embedded in the PDF the user will need the actual fonts on their system when they read the PDF file.

PDF Standard 14 Fonts

In non-Windows version, the following Adobe Type1 fonts are installed.

  • Courier.afm
  • Courier-Bold.afm
  • Courier-Oblique.afm
  • Courier-BoldOblique.afm
  • Helvetica.afm
  • Helvetica-Bold.afm
  • Helvetica-Oblique.afm
  • Helvetica-BoldOblique.afm
  • Times-Roman.afm
  • Times-Bold.afm
  • Times-Italic.afm
  • Times-BoldItalic.afm
  • Symbol.afm
  • ZapfDingbats.afm

Because .PFB is not included in these, it is not possible to embed it in PDF. Please refer to the bundled MustRead.html before you use.

These fonts can be downloaded from PDF core font information.

TrueType font, OpenType (TrueType outline) font

This section describes AH Formatter V6.5 implementation for TrueType and OpenType (TrueType outline) fonts. Tips on how to use these fonts in your environment are provided.

Font organization and necessary condition

TrueType fonts were originally developed by Apple Computer and have been used in the Windows environment. OpenType fonts were jointly developed by Adobe and Microsoft as cross-platform fonts. Due to the origin, OpenType fonts have two flavors/kinds. One has the TrueType outline. The other has the PostScript outline. OpenType font files that have the TrueType outline have the file extension .TTF or .TTC. OpenType font files that have the PostScript outline have the extension .OTF. This section treats original TrueType fonts and OpenType (TrueType outline) fonts together. From now on, we will use the term TrueType fonts as the contraction of TrueType font and OpenType (TrueType outline).

Macintosh TrueType font data fork suitcase is also TrueType font and its extension is .dfont or .dfon. Although it's somehow different from .TTF, since the treatment of TrueType is almost the same, its description is omitted here.

TrueType fonts are composed of a single file which has the extension .TTF or .TTC. TTC is the abbreviation of the TrueType Collection. It contains plural TrueType fonts in a single file structure. It is sometimes used in the CJK fonts.

TrueType font requirements:

  • Font must have the cmap table which enables mapping the Unicode to glyph index. (Almost TrueType fonts have the cmap table available).
  • Some older TrueType fonts do not have Code Page information in the OS/2 table (ulCodePageRange1, 2) which can negatively influence AH Formatter V6.5's font selection algorithms. For this reason we recommend not using old TrueType fonts.
Please visit the following sites to get more details about TrueType font (cmap table, etc)

How to use TrueType fonts

If you want to use TrueType fonts, locate the .TTF (.TTC) files in the directory specified in the <font-folder> element of the font configuration file. Then simply specify the font-family of the targeted font in FO.

<fo:block font-family="Arial" font-weight="bold" font-style="italic">
  If you install arialbi.ttf file,
  TrueType Arial (Bold-Italic) will be applied to this text.
</fo:block>

Embedding TrueType fonts

AH Formatter V6.5 supports embedding the TrueType font as well as the Type1 font into PDF. One big difference is the embedding license. TrueType font has the license information in OS/2 table fsType field. AH Formatter V6.5 respects this licensing information which will cause embedding errors when you specify font embedding against fonts with restrictions on embedding. In addition, only the used glyphs are embedded with the TrueType fonts.

The "PDF Reference" says that TrueType fonts should be embedded to get predictable behavior across all viewer applications. If you don't embed TrueType fonts into the PDF file, Adobe Acrobat or Reader sometimes reports errors for particular Unicode character and font combinations.

OpenType (PostScript outline) font

This section describes how AH Formatter V6.5 implements OpenType (PostScript outline) fonts. Tips on how to use OpenType fonts more conveniently in your environment are provided.

Font organization and necessary condition

OpenType (PostScript outline) is one flavor of OpenType fonts as described in Font organization and necessary condition. OpenType (PostScript outline) font files have an extension .OTF and consists of only a single file. In addition, OpenType(PostScript outline) is classified into two categories. One is OpenType (PostScript) CID font and the other is OpenType (PostScript) non-CID font. The following table gives a brief description of these categories.

TypeContentsTreatment in PDF
Non-CID font Mainly contains Latin character glyphs. Glyphs are indexed using glyph name. It is the same as Type1 font. Type1
CID fontMainly contains CJK ideograph glyphs. Glyphs are indexed using CID. Type0 (CIDFontType0)

How to use OpenType (PostScript outline) fonts

The usage and family-name, font-weight, font-style mapping conditions are the same as for TrueType fonts. Please refer to the Font organization and necessary condition for details.

Some OpenType (PostScript outline) fonts have a font-weight value that is not a multiple of 100. AH Formatter V6.5 rounds off the font-weight value.

Embedding OpenType (PostScript outline) fonts

Font embedding is the same as for TrueType fonts. Please refer to the Embedding TrueType fonts for details.

Integrate the family name using the alias name

Some OpenType (PostScript outline) CID fonts have a family name defined per font file. Originally these fonts belonged to the same family and each font file has a different font-weight value.

Font file Family-name Weight Italic
HeiseiKakuGoStd-W3.otf "Heisei Kaku Gothic Std W3" 300 Normal
HeiseiKakuGoStd-W5.otf "Heisei Kaku Gothic Std W5" 500 Normal
HeiseiKakuGoStd-W7.otf "Heisei Kaku Gothic Std W7" 700 Normal
HeiseiKakuGoStd-W9.otf "Heisei Kaku Gothic Std W9" 900 Normal

In the Windows environment it is not allowed to have more than three weight-values in the same family name. (Macintosh does allows such combinations). As a result, these fonts have different family name per font file. This makes it inconvenient to use these fonts using the different family name. To integrate the family names, the following alias descriptions to the font configuration file should be added.

<font-config>
  <font-folder path="[Install directory]/fonts">
    <glyph-list file="ZapfDingbats.txt" afm="ZapfDingbats.afm"/>
  </font-folder>
  <font-folder path="/home/resource/fonts">
    <!-- Integrate the four OTF font's family name to
         "Heisei Kaku Gothic Std"-->
    <font-alias  file="HeiseiKakuGoStd-W3.otf">
      <alias family-name="Heisei Kaku Gothic Std" weight="300"/>
    </font-alias>
    <font-alias  file="HeiseiKakuGoStd-W5.otf">
      <alias family-name="Heisei Kaku Gothic Std" weight="500"/>
    </font-alias>
    <font-alias  file="HeiseiKakuGoStd-W7.otf">
      <alias family-name="Heisei Kaku Gothic Std" weight="700"/>
    </font-alias>
    <font-alias  file="HeiseiKakuGoStd-W9.otf">
      <alias family-name="Heisei Kaku Gothic Std" weight="900"/>
    </font-alias>
  </font-folder>
</font-config>

The alias family name can be used in the FO as follows:

<fo:block font-family="Heisei Kaku Gothic Std" font-weight="300">
  "Heisei Kaku Gothic Std W3" will be applied to this text.
</fo:block>
<fo:block font-family="Heisei Kaku Gothic Std" font-weight="500">
  "Heisei Kaku Gothic Std W5" will be applied to this text.
</fo:block>
<fo:block font-family="Heisei Kaku Gothic Std" font-weight="700">
  "Heisei Kaku Gothic Std W7" will be applied to this text.
</fo:block>
<fo:block font-family="Heisei Kaku Gothic Std" font-weight="900">
  "Heisei Kaku Gothic Std W9" will be applied to this text.
</fo:block>

EUDC

EUDC: End User Defined Character is available with AH Formatter V6.5.

Since the information on EUDC is acquired from the registry, it is not necessary to create EUDC information to the Font Configuration File with Windows version. However when EUDC information is described by the Font Configuration File, it is also taken into consideration. With non-Windows version, it is necessary to create EUDC information to the Font Configuration File in order to use EUDC.

<font-config>
 <windows-registry reference="enable"/>
 <font-folder path="c:\Windows\Fonts"/>
 <eudc-processing mapping="enable">
  <eudc-range start="57344" end="63743"/>
  <eudc-system-default file-path="c:\Windows\Fonts\EUDC.TTE"/>
  <eudc-map family-name="MS Mincho" file-path="c:\Program Files\east\jinmei3\FEJPMIN.TTG"/>
  <eudc-map family-name="MS PMincho" file-path="c:\Program Files\east\jinmei3\FEJPMIN.TTG"/>
 </eudc-processing>
</font-config>

A user does not need to be conscious of utilizing EUDC. AH Formatter V6.5 changes the font automatically by the character code.

Restrictions

There are V1 and V2 specifications for Indic OpenType Fonts. V2 is the specification published by Microsoft in 2008 and corresponds to the fonts included with Windows Vista or later. The main differences between V1 and V2 specifications are as follows.

AH Formatter V6.5 integrates fonts based on the V1 specification. Many of fonts corresponding to the V2 specification are also included in the features of V1 specification. Fonts that only have the V2 compliant are not supported.

There are some known problems in the Indic fonts implementation with AH Formatter V6.5.

The following is not the problem of AH Formatter V6.5, hope you find it informative.