You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fonts.xml 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <!-- $Id$ -->
  17. <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
  18. <document>
  19. <header>
  20. <title>Apache™ FOP: Fonts</title>
  21. <version>$Revision$</version>
  22. <authors>
  23. <person name="Jeremias M&#xE4;rki" email=""/>
  24. <person name="Tore Engvig" email=""/>
  25. <person name="Adrian Cumiskey" email=""/>
  26. <person name="Max Berger" email=""/>
  27. </authors>
  28. </header>
  29. <body>
  30. <section id="intro">
  31. <title>Summary</title>
  32. <p>The following table summarizes the font capabilities of the various Apache� FOP renderers:</p>
  33. <table>
  34. <tr>
  35. <th>Renderer</th>
  36. <th>Base-14</th>
  37. <th>AWT/OS</th>
  38. <th>Custom</th>
  39. <th>Custom Embedding</th>
  40. </tr>
  41. <tr>
  42. <td>PDF</td>
  43. <td>yes</td>
  44. <td>no</td>
  45. <td>yes</td>
  46. <td>yes</td>
  47. </tr>
  48. <tr>
  49. <td>PostScript</td>
  50. <td>yes</td>
  51. <td>no</td>
  52. <td>yes</td>
  53. <td>yes</td>
  54. </tr>
  55. <tr>
  56. <td>PCL</td>
  57. <td>yes (modified)</td>
  58. <td>yes (painted as bitmaps)</td>
  59. <td>yes (painted as bitmaps)</td>
  60. <td>no</td>
  61. </tr>
  62. <tr>
  63. <td>AFP</td>
  64. <td>no</td>
  65. <td>no</td>
  66. <td>yes</td>
  67. <td>yes</td>
  68. </tr>
  69. <tr>
  70. <td>Java2D/AWT/Bitmap</td>
  71. <td>if available from OS</td>
  72. <td>yes</td>
  73. <td>yes</td>
  74. <td>n/a (display only)</td>
  75. </tr>
  76. <tr>
  77. <td>Print</td>
  78. <td>if available from OS</td>
  79. <td>yes</td>
  80. <td>yes</td>
  81. <td>controlled by OS printer driver</td>
  82. </tr>
  83. <tr>
  84. <td>RTF</td>
  85. <td>n/a (font metrics not needed)</td>
  86. <td>n/a</td>
  87. <td>n/a</td>
  88. <td>n/a</td>
  89. </tr>
  90. <tr>
  91. <td>TXT</td>
  92. <td>yes (used for layout but not for output)</td>
  93. <td>no</td>
  94. <td>yes (used for layout but not for output)</td>
  95. <td>no</td>
  96. </tr>
  97. <!--tr> NOT AVAILABLE
  98. <td>MIF</td>
  99. <td>n/a (font metrics not needed)</td>
  100. <td>n/a</td>
  101. <td>n/a</td>
  102. <td>n/a</td>
  103. </tr-->
  104. <!--tr> NOT AVAILABLE
  105. <td>SVG</td>
  106. <td>if available from OS</td>
  107. <td>yes</td>
  108. <td>no</td>
  109. <td>no</td>
  110. </tr-->
  111. <tr>
  112. <td>XML</td>
  113. <td>yes</td>
  114. <td>no</td>
  115. <td>yes</td>
  116. <td>n/a</td>
  117. </tr>
  118. </table>
  119. </section>
  120. <section>
  121. <title>Base-14 Fonts</title>
  122. <p>
  123. The Adobe PostScript and PDF Specification specify a set of 14 fonts that must be
  124. available to every PostScript interpreter and PDF reader:
  125. Helvetica (normal, bold, italic, bold italic),
  126. Times (normal, bold, italic, bold italic),
  127. Courier (normal, bold, italic, bold italic),
  128. Symbol and ZapfDingbats.
  129. </p>
  130. <p>
  131. The following font family names are hard-coded into FOP for the Base-14 font set:
  132. </p>
  133. <table>
  134. <tr>
  135. <th>Base-14 font</th>
  136. <th>font families</th>
  137. </tr>
  138. <tr>
  139. <td>Helvetica</td>
  140. <td>Helvetica, sans-serif, SansSerif</td>
  141. </tr>
  142. <tr>
  143. <td>Times</td>
  144. <td>Times, Times Roman, Times-Roman, serif, any</td>
  145. </tr>
  146. <tr>
  147. <td>Courier</td>
  148. <td>Courier, monospace, Monospaced</td>
  149. </tr>
  150. <tr>
  151. <td>Symbol</td>
  152. <td>Symbol</td>
  153. </tr>
  154. <tr>
  155. <td>ZapfDingbats</td>
  156. <td>ZapfDingbats</td>
  157. </tr>
  158. </table>
  159. <p>
  160. Please note that recent versions of Adobe Acrobat Reader replace
  161. "Helvetica" with "Arial" and "Times" with "Times New Roman" internally.
  162. GhostScript replaces "Helvetica" with "Nimbus Sans L" and "Times" with
  163. "Nimbus Roman No9 L". Other document viewers may do similar font
  164. substitutions. If you need to make sure that there are no such
  165. substitutions, you need to specify an explicit font and embed it in
  166. the target document.
  167. </p>
  168. </section>
  169. <section id="missing-fonts">
  170. <title>Missing Fonts</title>
  171. <p>
  172. When FOP does not have a specific font at its disposal (because it's
  173. not installed in the operating system or set up in FOP's configuration),
  174. the font is replaced with "any". "any" is internally mapped to the
  175. Base-14 font "Times" (see above).
  176. </p>
  177. </section>
  178. <section id="missing-glyphs">
  179. <title>Missing Glyphs</title>
  180. <p>
  181. Every font contains a particular set of
  182. <a href="http://en.wikipedia.org/wiki/Glyph">glyphs</a>. If no glyph can be found for
  183. a given character, FOP will issue a warning and use the glpyh for "#" (if available)
  184. instead. Before it does that, it consults a (currently hard-coded) registry of
  185. glyph substitution groups (see Glyphs.java in Apache XML Graphics Commons).
  186. This registry can supply alternative glyphs in some cases (like using space when a no-break
  187. space is requested). But there's no guarantee that the result will be as expected (for
  188. example, in the case of hyphens and similar glyphs). A better way is to use a font that
  189. has all the necessary glyphs. This glyph substitution is only a last resort.
  190. </p>
  191. </section>
  192. <section id="awt">
  193. <title>Java2D/AWT/Operating System Fonts</title>
  194. <p>
  195. The Java2D family of renderers (Java2D, AWT, Print, TIFF, PNG), use the
  196. Java AWT subsystem for font metric information. Through operating system
  197. registration, the AWT subsystem knows what fonts are available on the system,
  198. and the font metrics for each one.
  199. </p>
  200. <p>
  201. When working with one of these output formats and you're missing a font, just
  202. install it in your operating system and they should be available for these
  203. renderers. Please note that this is not true for other output formats such as
  204. PDF or PostScript.
  205. </p>
  206. </section>
  207. <section id="custom">
  208. <title>Custom Fonts</title>
  209. <p>
  210. Support for custom fonts is highly output format dependent (see above table).
  211. This section shows how to add Type 1 and TrueType fonts to the PDF, PostScript and
  212. Java2D-based renderers. Other renderers (like AFP) support other font formats. Details
  213. in this case can be found on the page about <a href="output.html">output formats</a>.
  214. </p>
  215. <p>
  216. In earlier FOP versions, it was always necessary to create an XML font metrics file
  217. if you wanted to add a custom font. This unconvenient step has been removed and in
  218. addition to that, FOP supports auto-registration of fonts, i.e. FOP can find fonts
  219. installed in your operating system or can scan user-specified directories for fonts.
  220. Font registration via XML font metrics file is still supported and may still be necessary
  221. for some very special cases as fallback variant while we stabilize font auto-detection.
  222. </p>
  223. <p>
  224. Basic information about fonts can be found at:
  225. </p>
  226. <ul>
  227. <li>
  228. <a href="http://partners.adobe.com/asn/developer/type/ftypes.html">Adobe font types</a>
  229. </li>
  230. <li>
  231. <a href="http://partners.adobe.com/asn/developer/technotes/fonts.html">Adobe Font Technote</a>
  232. </li>
  233. </ul>
  234. </section>
  235. <section id="basics">
  236. <title>Basic font configuration</title>
  237. <p>
  238. If you want FOP to use custom fonts, you need to tell it where to find them. This
  239. is done in the configuration file and once per renderer (because each output format
  240. is a little different). In the basic form, you can either tell FOP to find your
  241. operating system fonts or you can specify directories that it will search for
  242. support fonts. These fonts will then automatically be registered.
  243. </p>
  244. <source><![CDATA[
  245. <renderers>
  246. <renderer mime="application/pdf">
  247. <fonts>
  248. <!-- register all the fonts found in a directory -->
  249. <directory>C:\MyFonts1</directory>
  250. <!-- register all the fonts found in a directory and all of its sub directories (use with care) -->
  251. <directory recursive="true">C:\MyFonts2</directory>
  252. <!-- automatically detect operating system installed fonts -->
  253. <auto-detect/>
  254. </fonts>
  255. </renderer>
  256. </renderers>]]></source>
  257. <note>
  258. Review the documentation for <a href="configuration.html">FOP Configuration</a>
  259. for instructions on making the FOP configuration available to FOP when it runs.
  260. Otherwise, FOP has no way of finding your custom font information. It is currently
  261. not possible to easily configure fonts from Java code.
  262. </note>
  263. </section>
  264. <section id="advanced">
  265. <title>Advanced font configuration</title>
  266. <p>
  267. The instructions found above should be sufficient for most users. Below are some
  268. additional instructions in case the basic font configuration doesn't lead to
  269. the desired results.
  270. </p>
  271. <section id="type1-metrics">
  272. <title>Type 1 Font Metrics</title>
  273. <p>FOP includes PFMReader, which reads the PFM file that normally comes with a Type 1 font, and generates an appropriate font metrics file for it.
  274. To use it, run the class org.apache.fop.fonts.apps.PFMReader:</p>
  275. <p>Windows:</p>
  276. <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar
  277. org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source>
  278. <p>Unix:</p>
  279. <source>java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar
  280. org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source>
  281. <p>PFMReader [options]:</p>
  282. <ul>
  283. <li><strong>-fn &lt;fontname&gt;</strong> By default, FOP uses the fontname from the
  284. .pfm file when embedding the font. Use the "-fn" option to override this name with one you have
  285. chosen. This may be useful in some cases to ensure that applications using the output document
  286. (Acrobat Reader for example) use the embedded font instead of a local font with the same
  287. name.</li>
  288. </ul>
  289. <note>The classpath in the above example has been simplified for readability.
  290. You will have to adjust the classpath to the names of the actual JAR files in the lib directory.
  291. xml-apis.jar, xercesImpl.jar, xalan.jar and serializer.jar are not necessary for JDK version 1.4 or later.</note>
  292. <note>The tool will construct some values (FontBBox, StemV and ItalicAngle) based on assumptions and calculations which are only an approximation to the real values.
  293. FontBBox and Italic Angle can be found in the human-readable part of the PFB file or in the AFM file.
  294. The PFMReader tool does not yet interpret PFB or AFM files, so if you want to be correct, you may have to adjust the values in the XML file manually.
  295. The constructed values however appear to have no visible influence.</note>
  296. </section>
  297. <section id="truetype-metrics">
  298. <title>TrueType Font Metrics</title>
  299. <p>FOP includes TTFReader, which reads the TTF file and generates an appropriate font metrics file for it.
  300. Use it in a similar manner to PFMReader.
  301. For example, to create such a metrics file in Windows from the TrueType font at c:\myfonts\cmr10.ttf:</p>
  302. <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar
  303. org.apache.fop.fonts.apps.TTFReader [options]
  304. C:\myfonts\cmr10.ttf ttfcm.xml</source>
  305. <p>TTFReader [options]:</p>
  306. <ul>
  307. <li><strong>-d &lt;DEBUG | INFO &gt;</strong> Sets the debug level (default is
  308. INFO).</li>
  309. <li><strong>-fn &lt;fontname&gt;</strong> Same as for PFMReader.</li>
  310. <li><strong>-ttcname &lt;fontname&gt;</strong> If you're reading data from a
  311. TrueType Collection (.ttc file) you must specify which font from the collection you will read
  312. metrics from.
  313. If you read from a .ttc file without this option, the fontnames will be listed for you.</li>
  314. <li><strong>-enc ansi</strong> Creates a WinAnsi-encoded font metrics file.
  315. Without this option, a CID-keyed font metrics file is created.
  316. The table below summarizes the differences between these two encoding options as currently
  317. used within FOP.
  318. Please note that this information only applies to TrueType fonts and TrueType collections:</li>
  319. </ul>
  320. <table id="ttf-encoding">
  321. <tr>
  322. <th>Issue</th>
  323. <th>WinAnsi</th>
  324. <th>CID-keyed</th>
  325. </tr>
  326. <tr>
  327. <td>Usable Character Set</td>
  328. <td>Limited to WinAnsi character set, which is roughly equivalent to iso-8889-1.</td>
  329. <td>Limited only by the characters in the font itself.</td>
  330. </tr>
  331. <tr>
  332. <td>Embedding the Font</td>
  333. <td>Optional.</td>
  334. <td>Mandatory. Not embedding the font produces invalid PDF documents.</td>
  335. </tr>
  336. </table>
  337. <warning>
  338. You may experience failures with certain TrueType fonts, especially if they don't contain
  339. the so-called Unicode "cmap" table. TTFReader can currently not deal with font like this.
  340. </warning>
  341. </section>
  342. <section id="truetype-collections-metrics">
  343. <title>TrueType Collections</title>
  344. <p>TrueType collections (.ttc files) contain more than one font.
  345. To create metrics files for these fonts, you must specify which font in the collection should be generated, by using the "-ttcname" option with the TTFReader.</p>
  346. <p>To get a list of the fonts in a collection, just start the TTFReader as if it were a normal TrueType file (without the -ttcname option).
  347. It will display all of the font names and exit with an Exception.</p>
  348. <p>Here is an example of generating a metrics file for a .ttc file:</p>
  349. <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar
  350. org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho"
  351. msmincho.ttc msminch.xml</source>
  352. <p>
  353. Alternatively, the individual sub-fonts of a TrueType Collections can be selected
  354. using the "sub-font" attribute on the "font" element. That means that generating
  355. an XML font metrics file for TrueType collections is not necessary anymore. Example:
  356. </p>
  357. <source><![CDATA[<font embed-url="gulim.ttc" sub-font="GulimChe">
  358. <font-triplet name="GulimChe" style="normal" weight="normal"/>
  359. </font>]]></source>
  360. </section>
  361. <section id="register">
  362. <title>Register Fonts with FOP</title>
  363. <p>You must tell FOP how to find and use the font metrics files by registering them in the <a href="configuration.html">FOP Configuration</a>. Add entries for your custom fonts, regardless of font type, to the configuration file in a manner similar to the following:</p>
  364. <source><![CDATA[
  365. <renderers>
  366. <renderer mime="application/pdf">
  367. <fonts>
  368. <!-- register a particular font -->
  369. <font metrics-url="file:///C:/myfonts/FTL_____.xml" kerning="yes"
  370. embed-url="file:///C:/myfonts/FTL_____.pfb"
  371. encoding-mode="single-byte">
  372. <font-triplet name="FrutigerLight" style="normal" weight="normal"/>
  373. </font>
  374. <!-- register all the fonts found in a directory -->
  375. <directory>C:\MyFonts1</directory>
  376. <!-- register all the fonts found in a directory and all of its sub directories (use with care) -->
  377. <directory recursive="true">C:\MyFonts2</directory>
  378. <!-- automatically detect operating system installed fonts -->
  379. <auto-detect/>
  380. </fonts>
  381. </renderer>
  382. </renderers>]]></source>
  383. <ul>
  384. <li>
  385. URLs are used to access the font metric and font files.
  386. Relative URLs are resolved relative to the font-base property (or base) if available.
  387. See <a href="configuration.html">FOP: Configuration</a> for more information.
  388. </li>
  389. <li>The "metrics-url" attribute is generally not necessary except if you run into problems with certain fonts.</li>
  390. <li>Either an "embed-url" or a "metrics-url" must be specified for font tag configurations.</li>
  391. <li>The font "kerning" attribute is optional. Default is "true".</li>
  392. <li>If embedding is off (i.e. embed-url is not set), the output will position the text correctly (from the metrics file), but it will not be displayed or printed correctly unless the viewer has the applicable font available to their local system.</li>
  393. <li>When setting the "embed-url" attribute for Type 1 fonts, be sure to specify the PFB (actual font data), not PFM (font metrics) file that you used to generate the XML font metrics file.</li>
  394. <li>The attribute "encoding-mode" is optional an may have the following values:
  395. <ul>
  396. <li>auto: default font encoding mode ("cid" for Truetype, "single-byte" for Type 1)</li>
  397. <li>single-byte: use single-byte encodings in the target format (if applicable)</li>
  398. <li>cid: encode as CID-keyed font (currently only supported for PDF output with TrueType fonts)</li>
  399. </ul>
  400. </li>
  401. <li>The fonts "directory" tag can be used to register fonts contained within a single or list of directory paths. The "recursive" attribute can be specified to recursively add fonts from all sub directories.</li>
  402. <li>The fonts "auto-detect" tag can be used to automatically register fonts that are found to be installed on the native operating system.</li>
  403. <li>Fonts registered with "font" tag configurations override fonts found by means of "directory" tag definitions.</li>
  404. <li>Fonts found as a result of a "directory" tag configuration override fonts found as a result of the "auto-detect" tag being specified.</li>
  405. <li>
  406. If relative URLs are specified, they are evaluated relative to the value of the
  407. "font-base" setting. If there is no "font-base" setting, the fonts are evaluated
  408. relative to the base directory.
  409. </li>
  410. </ul>
  411. <!--note>Cocoon users will need to setup the config, see FOPSerializer for more information.</note-->
  412. </section>
  413. <section id="autodetect">
  414. <title>Auto-Detect and auto-embed feature</title>
  415. <p>When the "auto-detect" flag is set in the configuration, FOP will automatically search for fonts in the default paths for your operating system.</p>
  416. <p>FOP will also auto-detect fonts which are available in the classpath, if they are described as "application/x-font" in the MANIFEST.MF file. For example, if your .jar file contains font/myfont.ttf:</p>
  417. <source>Manifest-Version: 1.0
  418. Name: font/myfont.ttf
  419. Content-Type: application/x-font</source>
  420. <p>This feature allows you to create JAR files containing fonts. The JAR files can be added to fop by providem them in the classpath, e.g. copying them into the lib/ directory.</p>
  421. <section id="font-cache">
  422. <title>The font cache</title>
  423. <p>
  424. Apache FOP maintains a cache file that is used to speed up auto-detection. This file
  425. is usually found in the ".fop" directory under the user's home directory. It's called
  426. "fop-fonts.cache". When the user's home directory is not writable, the font cache file
  427. is put in the directory for temporary files.
  428. </p>
  429. <p>
  430. If there was a problem loading a particular font, it is flagged in the cache file so
  431. it is not loaded anymore. So, if a font is actually around but is still not found
  432. by Apache FOP, it's worth a try to delete the font cache file which forces Apache FOP
  433. to reparse all fonts.
  434. </p>
  435. </section>
  436. </section>
  437. <section id="embedding">
  438. <title>Embedding</title>
  439. <p>
  440. By default, all fonts are embedded if an output format supports font embedding. In some
  441. cases, however, it is preferred that some fonts are only referenced. When working
  442. with referenced fonts it is important to be in control of the target environment where
  443. the produced document is consumed, i.e. the necessary fonts have to be installed there.
  444. </p>
  445. <p>
  446. There are two different ways how you can specify that a font should be referenced:
  447. </p>
  448. <ol>
  449. <li>
  450. When using the old-style "font" element to configure a single font, font referencing
  451. is controlled by the embed-url attribute. If you don't specify the embed-url attribute
  452. the font will not be embedded, but will only be referenced.
  453. </li>
  454. <li>
  455. For automatically configured fonts there's a different mechanism to specify which
  456. fonts should be referenced rather than embedded. This is done in the "referenced-fonts"
  457. element in the configuration. Here's an example:
  458. </li>
  459. </ol>
  460. <source><![CDATA[
  461. <fop version="1.0">
  462. <fonts>
  463. <referenced-fonts>
  464. <match font-family="Helvetica"/>
  465. <match font-family="DejaVu.*"/>
  466. </referenced-fonts>
  467. </fonts>
  468. </fop>]]></source>
  469. <p>
  470. At the moment, you can only match fonts against their font-family. It is possible to use
  471. regular expressions as is shown in the second example above ("DejaVu.*"). The syntax for
  472. the regular expressions used here are the one used by the
  473. <a href="http://java.sun.com/j2se/1.4/docs/api/java/util/regex/package-summary.html"><code>java.util.regex</code> package</a>.
  474. So, in the above snippet "Helvetica" and all variants of the "DejaVu" font family are
  475. referenced. If you want to reference all fonts, just specify <code>font-family=".*"</code>.
  476. </p>
  477. <p>
  478. The <code>referenced-fonts</code> element can be placed either inside the general
  479. <code>fonts</code> element (right under the root) or in the <code>fonts</code> element
  480. under the renderer configuration. In the first case, matches apply to all renderers.
  481. In the second case, matches only apply to the renderer where the element was specified.
  482. Both cases can be used at the same time.
  483. </p>
  484. <p>
  485. Various notes related to embedded fonts:
  486. </p>
  487. <ul>
  488. <li>The PostScript renderer does not yet support TrueType fonts, but can embed Type 1 fonts.</li>
  489. <li>The font is simply embedded into the PDF file, it is not converted.</li>
  490. <li>When FOP embeds a font, it adds a prefix to the fontname to ensure that the name will not match the fontname of an installed font.
  491. This is helpful with older versions of Acrobat Reader that preferred installed fonts over embedded fonts.</li>
  492. <li>When embedding PostScript fonts, the entire font is always embedded.</li>
  493. <li>When embedding TrueType fonts (ttf) or TrueType Collections (ttc), a subset of the
  494. original font, containing only the glyphs used, is embedded in the output document.
  495. That's the default, but if you specify encoding-mode="single-byte" (see above), the
  496. complete font is embedded.</li>
  497. </ul>
  498. </section>
  499. <section id="substitution">
  500. <title>Substitution</title>
  501. <p>When a &lt;substitutions/&gt; section is defined in the configuration, FOP will re-map any font-family references found in your FO input to a given substitution font.</p>
  502. <ul>
  503. <li>If a &lt;substitution/&gt; is declared, it is mandatory that both a &lt;from/&gt; and &lt;to/&gt; child element is declared with a font-family attribute.</li>
  504. <li>Both font-weight and font-style are optional attributes, if they are provided then a value of 'normal' is assumed.</li>
  505. </ul>
  506. <p>For example you could make all FO font-family references to 'Arial' with weights between 700 and 900 reference the normal 'Arial Black' font.</p>
  507. <source><![CDATA[
  508. <fop version="1.0">
  509. <fonts>
  510. <substitutions>
  511. <substitution>
  512. <from font-family="Arial" font-weight="700..900"/>
  513. <to font-family="Arial Black"/>
  514. </substitution>
  515. <substitution>
  516. <from font-family="FrutigerLight"/>
  517. <to font-family="Times" font-weight="bold" font-style="italic"/>
  518. </substitution>
  519. </substitutions>
  520. </fonts>
  521. </fop>]]></source>
  522. </section>
  523. <!-- The following section should no longer be required
  524. <section id="embedding-base14">
  525. <title>Explicitly embedding the base 14 fonts</title>
  526. <p>
  527. There are cases where you might want to force the embedding of one or more of the base 14 fonts that
  528. can normally be considered available on the target platform (viewer, printer). One of these cases is
  529. <a href="pdfa.html">PDF/A</a> which mandates the embedding of even the base 14 fonts. Embedding a font such as Helvetica or
  530. Courier is straight-forward. The "Symbol" and "ZapfDingbats" fonts, however, currently present a
  531. problem because FOP cannot correctly determine the encoding of these two single-byte fonts through
  532. the PFM file. FOP now correctly interprets the "encoding" value in the XML font metrics file, but the
  533. PFMReader application writes "UnknownEncoding" to the generated XML file. In order to embed "Symbol"
  534. and "ZapfDingbats" you have to manually change the XML font metrics file and specify "SymbolEncoding"
  535. or "ZapfdingbatsEncoding" encoding respectively as the value for the "encoding" element.
  536. </p>
  537. <p>Example:</p>
  538. <source><![CDATA[
  539. <?xml version="1.0" encoding="UTF-8"?>
  540. <font-metrics type="TYPE1">
  541. <font-name>Symbol</font-name>
  542. <embed/>
  543. <encoding>SymbolEncoding</encoding>
  544. <cap-height>673</cap-height>
  545. <x-height>766</x-height>
  546. [..]]]></source>
  547. </section-->
  548. </section>
  549. <section id="selection">
  550. <title>Font Selection Strategies</title>
  551. <p>
  552. There are two font selection strategies: character-by-character or auto. The default is auto.</p>
  553. <p>Auto selected the first font from the list which is able to display the most characters in a given word. This means (assume font A has characters for abclmn, font B for lnmxyz, fontlist is A,B):</p>
  554. <ul>
  555. <li>aaa lll xxx would be displayed in fonts A A B</li>
  556. <li>aaaxx would be displayed in font A</li>
  557. <li>aaaxxx would be displayed in font A</li>
  558. <li>aaaxxxx would be displayed in font B</li>
  559. </ul>
  560. <p>Character-by-Character is NOT yet supported!</p>
  561. </section>
  562. <section id="font-list">
  563. <title>Font List Command-Line Tool</title>
  564. <p>
  565. FOP contains a small command-line tool that lets you generate a list of all configured
  566. fonts. Its class name is: <code>org.apache.fop.tools.fontlist.FontListMain</code>.
  567. Run it with the "-?" parameter to get help for the various options.
  568. </p>
  569. </section>
  570. </body>
  571. </document>