Fonts

This chapter explains about the fonts which AH Formatter V6.2 supports and how to use them. Also it explains the general consideration for each type of font. These are mainly for the no-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 Linux and Solaris 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.2 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 SVG Output.
See also Font Output in the PostScript Output.
See also Font in the INX Output.
See also Font Output in the XPS Output.

Supported font formats

AH Formatter V6.2 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.2, 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.2 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.

Initial Font Configuration File

The following is the initial Font Configuration File. After you have finished the installation of AH Formatter V6.2 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.2 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"
    name-processing-mode="windows-name">
  <!-- 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.

CAUTION: In the Windows version, [System font directory] is accessed when the file is formatted even if [System font directory] is not specified in the font configuration file.

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 Description
<font-config> root element name-processing-mode

Specifies whether to map Type1 font names to font file using only Windows names (.PFM+.PFB). Specifies the value "default" or "windows-name" to the value. The initial value is "default". The environment which "windows-name" is specified is called WindowsName mode.

<name-processing-mode mode="windows-name"/>
otf-metrics-mode

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

Specifies whether the information on NameID=16 is used for a font family name with TrueType or OpenType. If empty is specified or omitted the value is considered as "true".

windows-registry

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. If the attribute is omitted, it's detected as enable.

<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 If true is specified, inside of the subfolder included in the folder specified by path will also be searched. V6.2
<font-entry> child of <font-folder> file

Associated attributes are given to the font file specified by the "file" attribute.

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. For more information about glyph-list file, refer to the Glyph list file.

skip-glyphname-mapping

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. For more information about these parameters, refer to Skipping the glyph name mapping.

font-exclude

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

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. When font-size-adjust is not specified, the default value is 1.

baseline-adjust

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. When baseline-adjust is not specified, the default value is 0.

<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. 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". If omitted, the value is considered as "normal". "italic" attribute indicates the font-style for italic. It should be specified using the keyword "true" or "false". If omitted the value is considered as "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
italic
<eudc-processing> child of <font-config> mapping

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

<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 name-processing-mode (default|windows-name) "default">
<!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.2 supports them. It has tips on how to use Adobe Type1 fonts more conveniently in your environment.

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.2 supports both types of combinations: .AFM+.PFB, .PFM+.PFB files.

Type1 font considerations.

  • The current version of AH Formatter V6.2 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.2.
  • 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.2.

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>

AH Formatter V6.2 applies the following rules to map font-family, font-weight, font-style to Type1 fonts. Note that each .AFM and .PFM file has different mapping rules.

Mapping rule in .AFM file

Property in FO Mapping rule
font-family Corresponds to the FamilyName parameter value in the global font information in .AFM file.
font-weight Corresponds to the Weight parameter value in the global font information in .AFM file. The parameter value "Bold", "Demi", "ExtraBold" are assumed font-weight="bold". Other assumed value is font-weight="normal".
font-style Corresponds to the ItalicAngle parameter value in the writing direction information in .AFM file. The parameter value "0" is assumed font-style="normal". Other assumed value is font-style="italic".

The .AFM file is a text file so you can easily confirm these parameters using a text editor. If you want to know about .AFM files, please refer to the Adobe document Adobe Font Metrics File Format Specification.

In WindowsName Mode, the mapping rule for the .AFM file is not applied. In order to use the .AFM file in WindowsName Mode, please use Define the alias name of the font family.

Mapping rule in .PFM file

Property in FO Mapping rule
font-family Corresponds to the WindowsName field in .PFM file.
font-weight Corresponds to the dfWeight field of the PFMHEADER structure in .PFM file. This field holds the weight value 400 or 700.
font-style Corresponds to the dfItalic field in .PFM file. The field value "0" is assumed font-style="normal". Other assumed value is font-style="italic".

The .PFM file has a binary format. Generally you cannot see the contents using a text editor. If you want to know about .PFM files, please refer to the Adobe document Building PFM Files for PostScript-Language CJK Fonts. .PFM files were originally defined for Windows, but currently it is hard to get any of the original specification from Microsoft MSDN.

Sometimes there are differences between "FamilyName" in the .AFM file and "WindowsName" in the .PFM file or "Weight" parameter in the .AFM file and the dfItalic field in the .PFM file. For instance, Adobe supplied HVC_____.AFM has the family name "Helvetica", but the corresponding HVC_____.PFM defines the family name as "Helvetica-Condensed".

Embedding Adobe Type1 fonts

AH Formatter V6.2 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.

AH Formatter V6.2 embeds only what is being used among the glyphs of a Type1 font.

Unicode and glyph mapping using the .AFM file

To use Adobe Type1 font with .AFM files, it is important to know how Unicode characters are mapped into Type1 font glyphs. The following is a brief explanation of how Type1 fonts are treated in PDF files.

  • In the PDF file, letters which are associated with Type1 fonts are stored using 0-255 value character codes.
  • Each Type1 font in the PDF file has the encoding parameters, which defines the character code to the corresponding glyph-name.
  • The PDF reader application (typically Adobe Acrobat or Reader) converts the character codes to glyph-names using encoding parameters. Then reader then gets the Type1 glyph outline using the glyph-name as a key index. Finally the glyph is rendered using this outline data.
If you want to know more about encoding details, please refer to the D Character Sets and Encodings of the "PDF Reference".

Example: if the encoding parameter of the Type1 font is Adobe Standard Encoding, and we want to write a "•" (U+2022 BULLET) to a PDF file, we must select character code 0xB7(183) because the glyph-name of this character is "bullet" and it is defined as 0xB7 in the Adobe Standard Encoding.

Before we can write a character code to the PDF file we must first get the glyph-name from the Unicode. This process is described in the Adobe web site document Unicode and Glyph Names. The most important mapping rule is described in AGL (Adobe Glyph List) file. AGL is a simple text file that defines the Unicode to glyph name mapping rules for over 800 Latin characters. AH Formatter V6.2 uses this data to map the Unicode to glyph name. Following is a brief description of how AH Formatter V6.2 maps the Unicode value to glyph name and writes a character code to the PDF file.

  1. Starting with a Unicode text character in the FO file.
  2. AH Formatter V6.2 using the AGL data gets the glyph name from this Unicode character.
  3. Consulting the .AFM file, determines the encoding parameter for this Type1 font.
  4. Also consulting the .AFM file gets the character metrics information and character code from the glyph name.
  5. Writes the obtained character code and encoding information to the PDF file.

Unicode and glyph mapping using the .PFM file

If you are using Adobe Type1 fonts with .PFM files, AH Formatter V6.2 maps Unicode to glyphs differently than above, which does not use glyph names.

First, .PFM file has the only one encoding data in the dfCharSet field of PFM header. This one byte field contains the value known as character set. In the Windows environment, there are following character sets are defined in WINGDI.H header file.

dfCharset Symbol Value Code Page
ANSI_CHARSET01252
HEBREW_CHARSET1771255
ARABIC_CHARSET1781256
GREEK_CHARSET1611253
TURKISH_CHARSET1621254
VIETNAMESE_CHARSET1631258
THAI_CHARSET222874
EASTEUROPE_CHARSET2381250
RUSSIAN_CHARSET2041251
BALTIC_CHARSET1861257

Microsoft mapping can be found at the Unicode to code page mapping data. AH Formatter V6.2 uses this mapping data and converts the Unicode to the character code to write it to the PDF file. This mapping data has a maximum of 256 entries because the code page offers only 8-bit character width. You cannot use glyphs which are not defined in the code page data unless it exists in font the outline data.

Sometimes code page mapping and actual encoding in the font file do not match. Because of this it is not recommended to use principally Type1 fonts as .PFM+.PFB pairs principally. If you must use this combination, please use as a supplementary step.

Changing the glyph name mapping

As mentioned in Unicode and glyph mapping using the .AFM file, AGL offers the Unicode to glyph name mapping rules. It covers commonly used Latin characters. But there are special fonts which do not fit the AGL. For instance, the Adobe Type1 product Carta (CR______.AFM, CR______.PFM, CR______.PFB) has 189 pictorial glyphs and non-standard glyph names. If we look up the glyph names into the AGL, we will get the result that only 14-glyph names match and the others do not match with the AGL. If we leave it as it is, we cannot use most of the glyphs in the Carta with the .AFM+.PFB combination.

To solve such problem, AH Formatter V6.2 offers two solutions. One is to make a glyph list file for this font. Another is to specify the skip-glyphname-mapping in the font configuration XML file.

Glyph list file

The glyph list file is a simple text file, which describes the Unicode to glyph name mapping for a particular font. The format is the same as AGL.

  • First field is the Unicode value represented using 4 uppercase hexadecimal digits.
  • Second field is the glyph name defined in the .AFM file.
  • Third field is the Unicode character name. This field is optional.
  • All fields must be separated using semicolons. Lines starting with character "#" are assumed comments.

The following is a sample glyph list file. This glyph list file maps Unicode private user areas to the Carta glyph name with some exceptions. (Space and digits remain as is.)

# Carta sample glyphlist file
# file name:carta-glyphname.txt
0020;space;
E000;circle;
E001;lookoutcontrol;
E002;triangle;
E003;diamond;
E004;hexagon;
E005;explode2;
E006;lookout;
E007;IRBM;
E008;ICBM;
E009;explode1;
E00A;ruin;
E00B;goldbar;
E00C;lighthouse;
E00D;mining;
E00E;gaging;
0030;zero;
0031;one;
0032;two;
0033;three;
0034;four;
0035;five;
0036;six;
0037;seven;
0038;eight;
0039;nine;
E00F;boundary;
...

Once the glyph list file has been made, the next step is to add the glyph list file entry to the font configuration file. If the Carta font is located in the /home/resource/fonts directory, the following glyph-list entry should be made.

<font-config>
  <font-folder path="[Install directory]/fonts">
    <font-entry file="ZapfDingbats.afm"
          glyph-list="ZapfDingbats-glyphname.txt"/>
  </font-folder>
  <font-folder path="/home/resource/fonts">
    <font-entry file="CR______.AFM"
          glyph-list="carta-glyph-list.txt"/>
  </font-folder>
</font-config>

Once all glyph list files have been added successfully, the following FO will produce the PDF file shown below.

<fo:block font-family="Carta">
&#xE000; &#xE001; &#xE002; &#xE003; &#xE004;
&#xE005; &#xE006; &#xE007; &#xE008; &#xE009;
&#xE00A; &#xE00B; &#xE00C; &#xE00D; &#xE00E;
&#x0030; &#x0031; &#x0032; &#x0033; &#x0034;
&#x0035; &#x0036; &#x0037; &#x0038; &#x0039;
&#xE00F;
</fo:block>

Sample Carta PDF file

Skipping the glyph name mapping

Another way to use the Carta font is to specify the skip-glyphname-mapping in the font configuration XML file for AH Formatter V6.2 per for following example:

<font-config>
  <font-folder path="[Install directory]/fonts">
    <font-entry file="ZapfDingbats.afm"
          glyph-list="ZapfDingbats-glyphname.txt"/>
  </font-folder>
  <font-folder path="/home/resource/fonts">
    <font-entry file="CR______.AFM" skip-glyphname-mapping="true"/>
  </font-folder>
</font-config>

If this option is specified for the .AFM file, all of the associated Unicode characters in FO file are mapped to the characters in the PDF file as long as they are in the range of the font encoding. For instance, if the Unicode character is U+0021, this character will be written directly to the PDF file because Carta's encoding defines decimal value 33 as "circle". The Unicode character U+0101 will cause a missing glyph error, because it is not defined in the Carta's encoding. We can confirm which Unicode characters are available by consulting the .AFM files. Following is part of the Carta's .AFM file. If the Unicode character is equal to the number, which is to the right of the "C" character, it is available to use.

EncodingScheme FontSpecific
StartCharMetrics 189
C 32 ; WX 280 ; N space ; B 0 0 0 0 ;
C 33 ; WX 560 ; N circle ; B 30 150 530 650 ;
C 34 ; WX 620 ; N lookoutcontrol ; B 15 60 605 741 ;
...
C 250 ; WX 1042 ; N boat ; B 30 0 1012 280 ;
C 251 ; WX 852 ; N portofentry ; B 30 123 822 677 ;
C 252 ; WX 946 ; N whwycounty ; B 0 -58 946 857 ;
C 253 ; WX 1154 ; N whwytridown ; B 0 -100 1154 899 ;
C 254 ; WX 1072 ; N whwytriright ; B 0 -121 1073 919 ;
EndCharMetrics

If we want to obtain the same PDF results in the previous section, the FO contents should be as follows:

<fo:block font-family="Carta">
&#x0021; &#x0022; &#x0023; &#x0024; &#x0025;
&#x0026; &#x0027; &#x0028; &#x0029; &#x002A;
&#x002B; &#x002C; &#x002D; &#x002E; &#x002F;
&#x0030; &#x0031; &#x0032; &#x0033; &#x0034;
&#x0035; &#x0036; &#x0037; &#x0038; &#x0039;
&#x003A;
</fo:block>

Define the alias name of the font family

Some Type1 font family names are troublesome when installed. For instance, if you install Adobe product Eurostile Type1 font in .AFM+.PFB pair, there occurs a font selection problem depending on the font file combination. The following table describes the font family name problem for some font file combinations.

PFB name PFM information AFM information
WindowsName dfWeight dfItalic FullName FamilyName Weight ItalicAngle
EU______.PFB Eurostile 400 0 Eurostile Medium Eurostile Medium 0
EUB_____.PFB Eurostile Bold 400 0 Eurostile Bold Bold 0
EUEX____.PFB Eurostile ExtendedTwo 400 0 Eurostile Extended #2 Roman 0
EUBEX___.PFB Eurostile ExtendedTwo 700 0 Eurostile Bold Extended #2 Bold 0

If you use these fonts with .PFM+.PFB combination, there are no problems because the .PFM file exposes all the different font family names. In contrast, if you install these fonts with .AFM+.PFB combination, all of the font family names are Eurostile only. Furthermore, there are plural fonts that have the same weight value. The Weight value Medium and Roman are interpreted as font-weight="400" and Bold is interpreted as font-weight="700". Therefore the font selection is uncertain when you specify the following description in the FO.

<fo:block font-family="Eurostile">
  It is uncertain which font applies: "Eurostile Medium" or "Eurostile Extended #2"
</fo:block>
<fo:block font-family="Eurostile" font-weight="bold">
  It is uncertain which font applies: "Eurostile Bold" or "Eurostile Bold Extended #2"
</fo:block>

To avoid this problem, define a new family name using the alias element in the font configuration file. The following example defines the .PFM with like family name alias.

<font-config>
  <font-folder path="[Install directory]/fonts">
    <font-entry file="ZapfDingbats.afm"
          glyph-list="ZapfDingbats-glyphname.txt"/>
  </font-folder>
  <font-folder path="/home/resource/fonts">
    <!-- Set the family-name and weight to the PFM definition -->
    <font-alias  file="EU______.AFM">
      <alias family-name="Adobe Eurostile"/>
    </font-alias>
    <font-alias  file="EUB_____.AFM">
      <alias family-name="Adobe Eurostile Bold" weight="normal"/>
    </font-alias>
    <font-alias  file="EUEX____.AFM">
      <alias family-name="Adobe Eurostile ExtendedTwo"/>
    </font-alias>
    <font-alias  file="EUBEX___.AFM">
      <alias family-name="Adobe Eurostile ExtendedTwo" weight="bold"/>
    </font-alias>
  </font-folder>
</font-config>

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

<fo:block font-family="Adobe Eurostile">
  "Eurostile Medium" will be applied to this text.
</fo:block>
<fo:block font-family="Adobe Eurostile Bold">
  "Eurostile Bold" will be applied to this text.
</fo:block>
<fo:block font-family="Adobe Eurostile ExtendedTwo">
  "Eurostile Extended #2" will be applied to this text.
</fo:block>
<fo:block font-family="Adobe Eurostile ExtendedTwo" font-weight="bold">
  "Eurostile Bold Extended #2" will be applied to this text.
</fo:block>
The newly defined family-name attribute of the font-alias element should be different from any other alias name in the font file. In addition, weight and italic combinations should be unique in the same family name groups.

WindowsName mode

AH Formatter V6.2 Windows version can print the formatted results without generating a PDF file. Windows functionality is used to do this, thus the font usage is based on Windows. In other words, Windows accesses the fonts using WindowsName in the .PFM file. For this reason, there is a possibility mapping will fail if you use the FamilyName in the .AFM file. This problem can be avoided by specifying <name-processing-mode mode="windows-name"/> in the Font Configuration File. In this case you need to define the alias name for .AFM file because the .AFM file cannot be specified directly.

As a general rule Windows does not normally use/include the .AFM file, so this is not a common problem.

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.2 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.2'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>

AH Formatter V6.2 applies the following rules to map font-family, font-weight, font-style to TrueType fonts.

Property in FO Mapping rule
font-family Corresponds to the name table data whose Platform ID = 3 (Microsoft) and Platform-specific encoding ID = 1 (Unicode) and Name ID = 1 (Font Family Name).
font-weight Corresponds to the usWeightClass field value of the OS/2 table. This field contains the weight value that is multiple of 100 in the range from 100 to 900.
font-style Corresponds to the fsSelection field's least significant bit of the OS/2 table. If this bit is ON, font-style="italic" is assumed.

The information can be found by using Analysis tools for TrueType font (TTFdump) provided by Microsoft. For example, in order to refer to the font family of HG-GothicB, enter fffdump from the command line as follows.

>  ttfdump c:\winnt\fonts\HG-GothicB.ttf

Find the information that corresponds to the above mapping rules from the name table information. The information below maps to HG-GothicB. As Data shows the font family name, the font family name of HG-GothicB is "HGゴシックB".

 9. Platform ID:       3
    Specific ID:       1
    Language ID:       1041
    Name ID:           1
    Length:            14
    Offset:            362
       Data:  0 48  0 47 30 B4 30 B7 30 C3  <  .H.G0´0·0Ã
             30 AF  0 42                    <  0¯.B

Some fonts have the plural font family name with another Language ID. AH Formatter V6.2 supports this name for use as the font-family specification. For instance, simsun.ttf has the two family names "SimSun" and "宋体". Both names are valid to use.

Embedding TrueType fonts

AH Formatter V6.2 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.2 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. For instance, if you do not embed TrueType fonts, which are used with Thai characters, Adobe Acrobat or Reader will report the "font not found" error when opening the PDF file, even if the actual font exists. In contrast, the fonts which are used with Arabic characters do not cause errors when not embedded.

OpenType (PostScript outline) font

This section describes how AH Formatter V6.2 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)

OpenType is a new format standard requiring no special conditions to use it from AH Formatter V6.2.

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) has the font-weight value which is not a multiple of 100. AH Formatter V6.2 round 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.2.

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 no-Windows version, it is necessary to create EUDC information to the Font Configuration File in order to use EUDC.

<font-config>
 <name-processing-mode mode="windows-name"/>
 <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.2 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.2 integrates fonts based on the V1 specification. Many of fonts corresponding to the V2 specification are also included in the features of V1 specification.

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

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