From 1a1ba46dbffd9dc29d6d8e052a65b8533eb28743 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 3 Mar 2008 07:51:14 +0000 Subject: [PATCH] Tried to make font configuration easier to understand by splitting the basics from the advanced stuff. Otherwise, people will believe for the next 100 years that generating XML font metrics file is still always necessary. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@632972 13f79535-47bb-0310-9956-ffa450edef68 --- .../content/xdocs/0.95/fonts.xml | 206 ++++++++++++------ .../content/xdocs/trunk/fonts.xml | 206 ++++++++++++------ 2 files changed, 276 insertions(+), 136 deletions(-) diff --git a/src/documentation/content/xdocs/0.95/fonts.xml b/src/documentation/content/xdocs/0.95/fonts.xml index e12527fe3..af1de28f2 100644 --- a/src/documentation/content/xdocs/0.95/fonts.xml +++ b/src/documentation/content/xdocs/0.95/fonts.xml @@ -31,11 +31,6 @@
Summary - The FOP Font subsystem is currently undergoing a significant change. - The details provided here especially related to the generation of FOP Font - Metrics files and the FOP Font configuration are likely to change substantially - in the future. -

The following table summarizes the font capabilities of the various FOP renderers:

@@ -59,22 +54,22 @@ - + - - + - + + - + @@ -95,19 +90,26 @@ + + + + + + + + @@ -120,8 +122,8 @@
Base-14 Fonts

- The Adobe PDF Specification specifies a set of 14 fonts that must be - available to every PDF reader: + The Adobe PostScript and PDF Specification specify a set of 14 fonts that must be + available to every PostScript interpreter and PDF reader: Helvetica (normal, bold, italic, bold italic), Times (normal, bold, italic, bold italic), Courier (normal, bold, italic, bold italic), @@ -147,73 +149,140 @@

- AWT/Operating System Fonts -

The AWT family of renderers (AWT, Print, SVG), use the Java AWT libraries for font metric information. Through operating system registration, the AWT libraries know what fonts are available on the system, and the font metrics for each one.

+ Java2D/AWT/Operating System Fonts +

+ The Java2D family of renderers (Java2D, AWT, Print, TIFF, PNG), use the + Java AWT subsystem for font metric information. Through operating system + registration, the AWT subsystem knows what fonts are available on the system, + and the font metrics for each one. +

+

+ When working with one of these output formats and you're missing a font, just + install it in your operating system and they should be available for these + renderers. Please note that this is not true for other output formats such as + PDF or PostScript. +

+
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 fonts can be found at:

+

+ Support for custom fonts is highly output format dependent (see above table). + This section shows how to add Type 1 and TrueType fonts to the PDF, PostScript and + Java2D-based renderers. Other renderers (like AFP) support other font formats. Details + in this case can be found on the page about output formats. +

+

+ Prior to FOP version 0.94, it was always necessary to create an XML font metrics file + if you wanted to add a custom font. This unconvenient step has been removed and in + addition to that, FOP supports auto-registration of fonts, i.e. FOP can find fonts + installed in your operating system or can scan user-specified directories for fonts. + Font registration via XML font metrics file is still supported and is still necessary + if you want to use a TrueType Collection (*.ttc). Direct support for TrueType + collections may be added later. Furthermore, the XML font metrics files are still + required if you don't want to embed, but only reference a font. +

+

+ Basic information about fonts can be found at: +

+
+ +
+ Basic font configuration +

+ If you want FOP to use custom fonts, you need to tell it where to find them. This + is done in the configuration file and once per renderer (because each output format + is a little different). In the basic form, you can either tell FOP to find your + operating system fonts or you can specify directories that it will search for + support fonts. These fonts will then automatically be registered. +

+ + + C:\MyFonts1 + + + C:\MyFonts2 + + + +]]> + + 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. It is currently + not possible to easily configure fonts from Java code. + +
+ +
+ Advanced font configuration +

+ The instructions found above should be sufficient for most users. Below are some + additional instructions in case the basic font configuration doesn't lead to + the desired results. +

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:

+ To use it, run the class org.apache.fop.fonts.apps.PFMReader:

Windows (on JDK 1.4 and later):

java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file

Windows (on JDK 1.3.x):

java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar;lib\xml-apis.jar; - lib\xercesImpl.jar;lib\xalan.jar;lib\serializer.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file + lib\xercesImpl.jar;lib\xalan.jar;lib\serializer.jar + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file

Unix (on JDK 1.4 and later):

java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file

Unix (on JDK 1.3.1):

java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar:lib/xml-apis.jar: - lib/xercesImpl.jar:lib/xalan.jar:lib/serializer.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file + lib/xercesImpl.jar:lib/xalan.jar:lib/serializer.jar + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file

PFMReader [options]:

  • -fn <fontname> By default, FOP uses the fontname from the -.pfm file when embedding the font. Use the "-fn" option to override this name with one you have -chosen. This may be useful in some cases to ensure that applications using the output document -(Acrobat Reader for example) use the embedded font instead of a local font with the same -name.
  • + .pfm file when embedding the font. Use the "-fn" option to override this name with one you have + chosen. This may be useful in some cases to ensure that applications using the output document + (Acrobat Reader for example) use the embedded font instead of a local font with the same + name.
The classpath in the above example has been simplified for readability. -You will have to adjust the classpath to the names of the actual JAR files in the lib directory. -xml-apis.jar, xercesImpl.jar, xalan.jar and serializer.jar are not necessary for JDK version 1.4 or later. + You will have to adjust the classpath to the names of the actual JAR files in the lib directory. + xml-apis.jar, xercesImpl.jar, xalan.jar and serializer.jar are not necessary for JDK version 1.4 or later. The tool will construct some values (FontBBox, StemV and ItalicAngle) based on assumptions and calculations which are only an approximation to the real values. -FontBBox and Italic Angle can be found in the human-readable part of the PFB file or in the AFM file. -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. + FontBBox and Italic Angle can be found in the human-readable part of the PFB file or in the AFM file. + 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.
TrueType Font Metrics

FOP includes TTFReader, which reads the TTF file and generates an appropriate font metrics file for it. -Use it in a similar manner to PFMReader. -For example, to create such a metrics file in Windows from the TrueType font at c:\myfonts\cmr10.ttf:

+ Use it in a similar manner to PFMReader. + For example, to create such a metrics file in Windows from the TrueType font at c:\myfonts\cmr10.ttf:

java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar - org.apache.fop.fonts.apps.TTFReader [options] - C:\myfonts\cmr10.ttf ttfcm.xml + org.apache.fop.fonts.apps.TTFReader [options] + C:\myfonts\cmr10.ttf ttfcm.xml

TTFReader [options]:

  • -d <DEBUG | INFO > Sets the debug level (default is -INFO).
  • + INFO).
  • -fn <fontname> Same as for PFMReader.
  • -ttcname <fontname> If you're reading data from a -TrueType Collection (.ttc file) you must specify which font from the collection you will read -metrics from. -If you read from a .ttc file without this option, the fontnames will be listed for you.
  • + TrueType Collection (.ttc file) you must specify which font from the collection you will read + metrics from. + If you read from a .ttc file without this option, the fontnames will be listed for you.
  • -enc ansi Creates a WinAnsi-encoded font metrics file. -Without this option, a CID-keyed font metrics file is created. -The table below summarizes the differences between these two encoding options as currently -used within FOP. -Please note that this information only applies to TrueType fonts and TrueType collections:
  • + Without this option, a CID-keyed font metrics file is created. + The table below summarizes the differences between these two encoding options as currently + used within FOP. + Please note that this information only applies to TrueType fonts and TrueType collections:
yes yes
TXTyes (used for layout but not for output)AFP noyes (used for layout but not for output) noyesyes
AWTJava2D/AWT/Bitmap if available from OS yes yesn/a
TXTyes (used for layout but not for output)noyes (used for layout but not for output)no
XML yes
@@ -240,13 +309,13 @@ Please note that this information only applies to TrueType fonts and TrueType co
TrueType Collections Font Metrics

TrueType collections (.ttc files) contain 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.

+ It will display all of the font names and exit with an Exception.

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

java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar - org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho" - msmincho.ttc msminch.xml + org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho" + msmincho.ttc msminch.xml
Register Fonts with FOP @@ -269,16 +338,16 @@ It will display all of the font names and exit with an Exception.

]]> - 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.
  • URLs are used to access the font metric and font files. Relative URLs are resolved relative to the font-base property (or base) if available. See FOP: Configuration for more information.
  • +
  • The "metrics-url" attribute is generally not necessary except if you run into problems with certain fonts.
  • Either an "embed-url" or a "metrics-url" must be specified for font tag configurations.
  • -
  • The font "kerning" attribute is optional.
  • -
  • 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.
  • +
  • The font "kerning" attribute is optional. Default is "true".
  • +
  • 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.
  • 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.
  • 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.
  • The fonts "auto-detect" tag can be used to automatically register fonts that are found to be installed on the native operating system.
  • @@ -294,37 +363,38 @@ It will display all of the font names and exit with an Exception.

Auto-Detect and auto-embedd feature -

When the "auto-detect" flag is set in the configuration, FOP will automatically search for fonts in the default paths for your operating system.

-

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:

- Manifest-Version: 1.0 - -Name: font/myfont.ttf -Content-Type: application/x-font -

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.

+

When the "auto-detect" flag is set in the configuration, FOP will automatically search for fonts in the default paths for your operating system.

+

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:

+ Manifest-Version: 1.0 + + Name: font/myfont.ttf + Content-Type: application/x-font +

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.

Embedding The PostScript renderer does not yet support TrueType fonts, but can embed Type 1 fonts. The font is simply embedded into the PDF file, it is not converted.

Font embedding is enabled in the userconfig.xml file and controlled by the embed-url attribute. -If you don't specify the embed-url attribute the font will not be embedded, but will only be referenced.

+ If you don't specify the embed-url attribute the font will not be embedded, but will only be referenced.

Omitting the embed-url attribute for CID-encoded TrueType fonts will currently produce invalid PDF files! If you create the XML font metric file using the "-enc ansi" option, you can omit the embed-url attribute for TrueType fonts but you're restricted to the WinAnsi character set.

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. -This is helpful with older versions of Acrobat Reader that preferred installed fonts over embedded fonts.

+ This is helpful with older versions of Acrobat Reader that preferred installed fonts over embedded fonts.

When embedding PostScript fonts, the entire font is always embedded.

When embedding TrueType fonts (ttf) or TrueType Collections (ttc), a subset of the original font, containing only the glyphs used, is embedded in the output document.

+ diff --git a/src/documentation/content/xdocs/trunk/fonts.xml b/src/documentation/content/xdocs/trunk/fonts.xml index e12527fe3..af1de28f2 100644 --- a/src/documentation/content/xdocs/trunk/fonts.xml +++ b/src/documentation/content/xdocs/trunk/fonts.xml @@ -31,11 +31,6 @@
Summary - The FOP Font subsystem is currently undergoing a significant change. - The details provided here especially related to the generation of FOP Font - Metrics files and the FOP Font configuration are likely to change substantially - in the future. -

The following table summarizes the font capabilities of the various FOP renderers:

@@ -59,22 +54,22 @@ - + - - + - + + - + @@ -95,19 +90,26 @@ + + + + + + + + @@ -120,8 +122,8 @@
Base-14 Fonts

- The Adobe PDF Specification specifies a set of 14 fonts that must be - available to every PDF reader: + The Adobe PostScript and PDF Specification specify a set of 14 fonts that must be + available to every PostScript interpreter and PDF reader: Helvetica (normal, bold, italic, bold italic), Times (normal, bold, italic, bold italic), Courier (normal, bold, italic, bold italic), @@ -147,73 +149,140 @@

- AWT/Operating System Fonts -

The AWT family of renderers (AWT, Print, SVG), use the Java AWT libraries for font metric information. Through operating system registration, the AWT libraries know what fonts are available on the system, and the font metrics for each one.

+ Java2D/AWT/Operating System Fonts +

+ The Java2D family of renderers (Java2D, AWT, Print, TIFF, PNG), use the + Java AWT subsystem for font metric information. Through operating system + registration, the AWT subsystem knows what fonts are available on the system, + and the font metrics for each one. +

+

+ When working with one of these output formats and you're missing a font, just + install it in your operating system and they should be available for these + renderers. Please note that this is not true for other output formats such as + PDF or PostScript. +

+
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 fonts can be found at:

+

+ Support for custom fonts is highly output format dependent (see above table). + This section shows how to add Type 1 and TrueType fonts to the PDF, PostScript and + Java2D-based renderers. Other renderers (like AFP) support other font formats. Details + in this case can be found on the page about output formats. +

+

+ Prior to FOP version 0.94, it was always necessary to create an XML font metrics file + if you wanted to add a custom font. This unconvenient step has been removed and in + addition to that, FOP supports auto-registration of fonts, i.e. FOP can find fonts + installed in your operating system or can scan user-specified directories for fonts. + Font registration via XML font metrics file is still supported and is still necessary + if you want to use a TrueType Collection (*.ttc). Direct support for TrueType + collections may be added later. Furthermore, the XML font metrics files are still + required if you don't want to embed, but only reference a font. +

+

+ Basic information about fonts can be found at: +

+
+ +
+ Basic font configuration +

+ If you want FOP to use custom fonts, you need to tell it where to find them. This + is done in the configuration file and once per renderer (because each output format + is a little different). In the basic form, you can either tell FOP to find your + operating system fonts or you can specify directories that it will search for + support fonts. These fonts will then automatically be registered. +

+ + + C:\MyFonts1 + + + C:\MyFonts2 + + + +]]> + + 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. It is currently + not possible to easily configure fonts from Java code. + +
+ +
+ Advanced font configuration +

+ The instructions found above should be sufficient for most users. Below are some + additional instructions in case the basic font configuration doesn't lead to + the desired results. +

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:

+ To use it, run the class org.apache.fop.fonts.apps.PFMReader:

Windows (on JDK 1.4 and later):

java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file

Windows (on JDK 1.3.x):

java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar;lib\xml-apis.jar; - lib\xercesImpl.jar;lib\xalan.jar;lib\serializer.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file + lib\xercesImpl.jar;lib\xalan.jar;lib\serializer.jar + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file

Unix (on JDK 1.4 and later):

java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file

Unix (on JDK 1.3.1):

java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar:lib/xml-apis.jar: - lib/xercesImpl.jar:lib/xalan.jar:lib/serializer.jar - org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file + lib/xercesImpl.jar:lib/xalan.jar:lib/serializer.jar + org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file

PFMReader [options]:

  • -fn <fontname> By default, FOP uses the fontname from the -.pfm file when embedding the font. Use the "-fn" option to override this name with one you have -chosen. This may be useful in some cases to ensure that applications using the output document -(Acrobat Reader for example) use the embedded font instead of a local font with the same -name.
  • + .pfm file when embedding the font. Use the "-fn" option to override this name with one you have + chosen. This may be useful in some cases to ensure that applications using the output document + (Acrobat Reader for example) use the embedded font instead of a local font with the same + name.
The classpath in the above example has been simplified for readability. -You will have to adjust the classpath to the names of the actual JAR files in the lib directory. -xml-apis.jar, xercesImpl.jar, xalan.jar and serializer.jar are not necessary for JDK version 1.4 or later. + You will have to adjust the classpath to the names of the actual JAR files in the lib directory. + xml-apis.jar, xercesImpl.jar, xalan.jar and serializer.jar are not necessary for JDK version 1.4 or later. The tool will construct some values (FontBBox, StemV and ItalicAngle) based on assumptions and calculations which are only an approximation to the real values. -FontBBox and Italic Angle can be found in the human-readable part of the PFB file or in the AFM file. -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. + FontBBox and Italic Angle can be found in the human-readable part of the PFB file or in the AFM file. + 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.
TrueType Font Metrics

FOP includes TTFReader, which reads the TTF file and generates an appropriate font metrics file for it. -Use it in a similar manner to PFMReader. -For example, to create such a metrics file in Windows from the TrueType font at c:\myfonts\cmr10.ttf:

+ Use it in a similar manner to PFMReader. + For example, to create such a metrics file in Windows from the TrueType font at c:\myfonts\cmr10.ttf:

java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar - org.apache.fop.fonts.apps.TTFReader [options] - C:\myfonts\cmr10.ttf ttfcm.xml + org.apache.fop.fonts.apps.TTFReader [options] + C:\myfonts\cmr10.ttf ttfcm.xml

TTFReader [options]:

  • -d <DEBUG | INFO > Sets the debug level (default is -INFO).
  • + INFO).
  • -fn <fontname> Same as for PFMReader.
  • -ttcname <fontname> If you're reading data from a -TrueType Collection (.ttc file) you must specify which font from the collection you will read -metrics from. -If you read from a .ttc file without this option, the fontnames will be listed for you.
  • + TrueType Collection (.ttc file) you must specify which font from the collection you will read + metrics from. + If you read from a .ttc file without this option, the fontnames will be listed for you.
  • -enc ansi Creates a WinAnsi-encoded font metrics file. -Without this option, a CID-keyed font metrics file is created. -The table below summarizes the differences between these two encoding options as currently -used within FOP. -Please note that this information only applies to TrueType fonts and TrueType collections:
  • + Without this option, a CID-keyed font metrics file is created. + The table below summarizes the differences between these two encoding options as currently + used within FOP. + Please note that this information only applies to TrueType fonts and TrueType collections:
yes yes
TXTyes (used for layout but not for output)AFP noyes (used for layout but not for output) noyesyes
AWTJava2D/AWT/Bitmap if available from OS yes yesn/a
TXTyes (used for layout but not for output)noyes (used for layout but not for output)no
XML yes
@@ -240,13 +309,13 @@ Please note that this information only applies to TrueType fonts and TrueType co
TrueType Collections Font Metrics

TrueType collections (.ttc files) contain 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.

+ It will display all of the font names and exit with an Exception.

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

java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar - org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho" - msmincho.ttc msminch.xml + org.apache.fop.fonts.apps.TTFReader -ttcname "MS Mincho" + msmincho.ttc msminch.xml
Register Fonts with FOP @@ -269,16 +338,16 @@ It will display all of the font names and exit with an Exception.

]]> - 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.
  • URLs are used to access the font metric and font files. Relative URLs are resolved relative to the font-base property (or base) if available. See FOP: Configuration for more information.
  • +
  • The "metrics-url" attribute is generally not necessary except if you run into problems with certain fonts.
  • Either an "embed-url" or a "metrics-url" must be specified for font tag configurations.
  • -
  • The font "kerning" attribute is optional.
  • -
  • 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.
  • +
  • The font "kerning" attribute is optional. Default is "true".
  • +
  • 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.
  • 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.
  • 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.
  • The fonts "auto-detect" tag can be used to automatically register fonts that are found to be installed on the native operating system.
  • @@ -294,37 +363,38 @@ It will display all of the font names and exit with an Exception.

Auto-Detect and auto-embedd feature -

When the "auto-detect" flag is set in the configuration, FOP will automatically search for fonts in the default paths for your operating system.

-

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:

- Manifest-Version: 1.0 - -Name: font/myfont.ttf -Content-Type: application/x-font -

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.

+

When the "auto-detect" flag is set in the configuration, FOP will automatically search for fonts in the default paths for your operating system.

+

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:

+ Manifest-Version: 1.0 + + Name: font/myfont.ttf + Content-Type: application/x-font +

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.

Embedding The PostScript renderer does not yet support TrueType fonts, but can embed Type 1 fonts. The font is simply embedded into the PDF file, it is not converted.

Font embedding is enabled in the userconfig.xml file and controlled by the embed-url attribute. -If you don't specify the embed-url attribute the font will not be embedded, but will only be referenced.

+ If you don't specify the embed-url attribute the font will not be embedded, but will only be referenced.

Omitting the embed-url attribute for CID-encoded TrueType fonts will currently produce invalid PDF files! If you create the XML font metric file using the "-enc ansi" option, you can omit the embed-url attribute for TrueType fonts but you're restricted to the WinAnsi character set.

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. -This is helpful with older versions of Acrobat Reader that preferred installed fonts over embedded fonts.

+ This is helpful with older versions of Acrobat Reader that preferred installed fonts over embedded fonts.

When embedding PostScript fonts, the entire font is always embedded.

When embedding TrueType fonts (ttf) or TrueType Collections (ttc), a subset of the original font, containing only the glyphs used, is embedded in the output document.

+ -- 2.39.5