From 58ef9375e4416ab450dded44c43e5f9e26c33f07 Mon Sep 17 00:00:00 2001 From: William Victor Mote Date: Thu, 10 Jul 2003 06:47:38 +0000 Subject: [PATCH] Consolidate font registration information, and add cross-references between configuration and font documents. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196672 13f79535-47bb-0310-9956-ffa450edef68 --- .../content/xdocs/configuration.xml | 4 ++ src/documentation/content/xdocs/fonts.xml | 57 +++++++++---------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/documentation/content/xdocs/configuration.xml b/src/documentation/content/xdocs/configuration.xml index 2099443f6..ca1b2ffcb 100644 --- a/src/documentation/content/xdocs/configuration.xml +++ b/src/documentation/content/xdocs/configuration.xml @@ -126,6 +126,10 @@ in the userconfig.xml in the entry <hyphenation-dir>. strokeSVGText is currently only effective in the PDF renderer. +
+ Fonts +

Font configuration information is included in the FOP configuration file, but is documented at FOP: Fonts. Note especially the section entitled Register Fonts with FOP.

+
diff --git a/src/documentation/content/xdocs/fonts.xml b/src/documentation/content/xdocs/fonts.xml index ec055f2cb..b403a4e9f 100644 --- a/src/documentation/content/xdocs/fonts.xml +++ b/src/documentation/content/xdocs/fonts.xml @@ -104,11 +104,15 @@
Custom Fonts

Support for custom fonts is added by creating font metric files (written in XML) from the actual font files, and registering them with FOP. Currently only Type 1 and TrueType fonts can be added. -More information about font types can be found at the Adobe font types. -There is also lots more font information on this Adobe Font Technote.

+More information about fonts can be found at:

+
- Create Type 1 Font Metrics -

FOP includes a tool that can generate an appropriate font metrics file from the PFM file that normally comes with the Type 1 font file. + Type 1 Font Metrics +

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. To use it, run the class org.apache.fop.fonts.apps.PFMReader:

Windows:

java -cp build\fop.jar;lib\avalon-framework.jar;lib\xml-apis.jar; @@ -127,22 +131,8 @@ FontBBox and Italic Angle can be found in the human-readable part of the PFB fil 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. The constructed values however appear to have no visible influence.
-
- Register Type 1 Font Metrics with FOP -

Edit conf/userconfig.xml and add entries for the font in the fonts section, e.g.:

- - -]]> - Starting with FOP version 0.20.5 you can use URLs for the paths to the font files. -Relative URLs are resolved relative to the fontBaseDir property (or baseDir) if available. - Make sure you specify the PFB file in the embed-file attribute and not the PFM you used to generate the XML font metrics file. - If you do not want the font embedded in the PDF then remove the "embed-file" attribute. -The PDF will then contain text using the font with the font metrics and to view it properly the font will need to be installed where it is being viewed. - Cocoon users will need to setup the config, see FOPSerializer for more information. -
- Creating TrueType Font Metrics + TrueType Font Metrics

FOP includes a tool that can generate an appropriate font metrics file from your TrueType font file. To create such a file in Windows from the TrueType font at c:\myfonts\cmr10.ttf:

java -cp build\fop.jar;lib\avalon-framework.jar;lib\xml-apis.jar; lib\xercesImpl.jar;lib\xalan.jar @@ -150,26 +140,32 @@ The PDF will then contain text using the font with the font metrics and to view C:\myfonts\cmr10.ttf ttfcm.xml
- Creating TrueType Collections Font Metrics + TrueType Collections Font Metrics

TrueType collections (.ttc files) contains more than one font. -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:

+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.

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). It will display all of the font names and exit with an Exception.

-

Example on generating metrics for a .ttc file:

+

Here is an example of generating a metrics file for a .ttc file:

java -cp build\fop.jar;lib\avalon-framework.jar;lib\xml-apis.jar; lib\xercesImpl.jar;lib\xalan.jar org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho" msmincho.ttc msminch.xml
-
- Register the fonts within FOP -

- Similiar to Type 1 fonts. -

- - +
+ Register Fonts with FOP +

You must tell FOP how to find and use the font metrics files by registering them in the FOP Configuration. Add entries for your custom fonts, regardless of font type, to the configuration file in a manner similar to the following:

+ + ]]> + Review the documentation for FOP Configuration for instructions on making the FOP configuration available to FOP when it runs. Otherwise, FOP has no way of finding your custom font information. +
    +
  • Starting with FOP version 0.20.5 you can use URLs for the paths to the font files. +Relative URLs are resolved relative to the fontBaseDir property (or baseDir) if available. See FOP: Configuration for more information.
  • +
  • The "kerning" and "embed-file" attributes are optional. Kerning is currently not used at all. If embedding is off, 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.
  • +
  • When setting the embed-file 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.
  • +
+ Cocoon users will need to setup the config, see FOPSerializer for more information.
@@ -189,6 +185,5 @@ While the document will be displayed correctly, the net effect of this is that s This will cause the whole font to be embedded in the pdf document. Characters will be WinAnsi encoded (as specified in the PDF spec), so you lose the ability to use characters from other character sets.

- Be sure to start FOP with the option to find the config file ("-c conf/userconfig.xml" from the command line). Otherwise, it has no way of finding your custom font information. -- 2.39.5