diff options
author | fotis <fotis@unknown> | 2001-02-05 23:59:53 +0000 |
---|---|---|
committer | fotis <fotis@unknown> | 2001-02-05 23:59:53 +0000 |
commit | 1a3636171f599e31d9964fbcf6e32cfc3e6fbbf3 (patch) | |
tree | fcdc80683dcc70d51f8feec331a55de4c677730b /docs/xml-docs/fop/fonts.xml | |
parent | 159fe7fb1fadf243ac86921b48910220b3f1188d (diff) | |
download | xmlgraphics-fop-1a3636171f599e31d9964fbcf6e32cfc3e6fbbf3.tar.gz xmlgraphics-fop-1a3636171f599e31d9964fbcf6e32cfc3e6fbbf3.zip |
updating docs for 0.17 release
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194024 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'docs/xml-docs/fop/fonts.xml')
-rw-r--r-- | docs/xml-docs/fop/fonts.xml | 63 |
1 files changed, 59 insertions, 4 deletions
diff --git a/docs/xml-docs/fop/fonts.xml b/docs/xml-docs/fop/fonts.xml index 81a94aec5..01869e8e1 100644 --- a/docs/xml-docs/fop/fonts.xml +++ b/docs/xml-docs/fop/fonts.xml @@ -1,19 +1,19 @@ <?xml version="1.0" standalone="no"?> <!-- Font Support --> -<!-- Author: jeremias.maerki@outline.ch --> +<!-- Authors: Jeremias Maerki, Tore Engvig--> <s1 title="Font Support "> <s2 title="Status"> <p>FOP (building PDF files) normally supports only the base 14 font package defined in the Adobe PDF specification. That includes the following fonts: Helvetica, Times, Courier, Symbol and ZapfDingbats. </p> <p>Font support in FOP can be extended by the addition of font metric files (written in XML) created from Adobe - Type 1 fonts. No other font types (TrueType, Type 0, Type 3, etc.) are supported at this time. The current method - of adding fonts to FOP requires the package to be recompiled. + Type 1 fonts and Truetype fonts. No other font types (Type 0, Type 3, etc.) are supported at this time. The current method + of adding fonts to FOP requires the package to be recompiled. You can also embed fonts into pdf files; see below. </p> </s2> <s2 title="Adding additional Type 1 fonts"> <p>As mentioned above you need an XML file containing font metrics to be able to use an additional font. FOP - contains a tool that can generate such a font metrics file from a PFM file. + contains a tool that can generate such a font metrics file from a PFM file, which normally comes with the font file. </p> <s3 title="Generating a font metrics file"> <p> Run the class org.apache.fop.fonts.apps.PFMReader to generate the XML file. Important: The tool does two @@ -91,4 +91,59 @@ </p> </s3> </s2> + <s2 title="Adding additional TrueType"> + <p>Adding Truetype fonts is almost identical to the process of adding type 1 fonts. The main difference is in the first step.</p> + <s3 title="Generating a font metrics file"> + <p>As mentioned above you need an XML file containing font metrics to be able to use an additional font. FOP + contains a tool that can generate such a font metrics file from your truetype font file + </p> + <p>Create metrics for the fontfile (we assume the file has the name cmr10.ttf und to be in c:\myfonts\): </p> + <p><code>java org.apache.fop.fonts.apps.TTFReader -fn TCM -cn TCM -ef C:\myfonts\cmr10.ttf C:\myfonts\cmr10.ttf ttfcm.xml</code></p> + <p>the -fn option sets the font name (in the example to TCM )</p> + <p>the -cn option set the classname (in the example to CM)</p> + <p>the -ef option will try to embed to font at the given path when fop is running (you can + change that in the generated xml file). </p> + </s3> + <s3 title="Register the fonts within FOP"> + <p>Open the class org.apache.fop.render.pdf.FontSetup and add entries to the ones present according to + the following example: + </p> + <p> + <code>fontInfo.addMetrics("F14", new ZapfDingbats());</code> + </p> + <p> + <code>fontInfo.addMetrics("F19", new TCM()); //This is the new entry.</code> + </p> + <p> + <code>...</code> + </p> + <p> + <code>fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", "normal");</code> + </p> + <p> + <code>fontInfo.addFontProperties("F19", "TCM", "normal", "normal"); //This is the new entry.</code> + </p> + <p>Note: The class name to use is visible in the <class-name> element of the font metrics file. + </p> + </s3> + <s3 title="Adjusting build.xml"> + <p>In the src/codegen directory you find the font metrics files for the base 14 fonts. The are being transformed + during build into Java classes and then compiled. The newly generated font metrics file must be included in this + process. To do that open build.xml and add entries according to the following example: + </p> + <p>Look for the section "Initialization target" and add the following line at the end of it</p> + <p><code><property name="tcm.xml" value="${build.codegen}/tcm.xml"></code></p> + <p>then search for the section "Generate the source code". At the end of this section you can find + templates for type 1 and truetype fonts. use them with your font name:</p> + <p><code><xslt infile="${tcm.xml}" xsltfile="${ttffontfile.xsl}" + outfile="${build.src}/${replacestring}/render/pdf/fonts/TCM.java" smart="yes"/></code></p> + </s3> + <s3 title="embedding fonts"> + <p>edit conf\userconfig.xml and add TCM to the list of embedded fonts</p> + <p>Don't forget: If you have embedded fonts, you must run Fop with the flag -cuserconfig.xml, + otherwise the settings in userconfig.xml will not be read.</p> + </s3> + <p>Rebuild FOP!</p> + + </s2> </s1> |