You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by bu...@apache.org on 2012/04/15 07:39:54 UTC

svn commit: r813018 [20/24] - in /websites/staging/xmlgraphics/trunk/content: ./ fop/ fop/0.95/ fop/0.95/images/ fop/1.0/ fop/1.0/images/ fop/dev/ fop/dev/design/ fop/dev/fo/ fop/dev/svg/ fop/fo/ fop/trunk/ fop/trunk/images/

Added: websites/staging/xmlgraphics/trunk/content/fop/trunk/complexscripts.html
==============================================================================
--- websites/staging/xmlgraphics/trunk/content/fop/trunk/complexscripts.html (added)
+++ websites/staging/xmlgraphics/trunk/content/fop/trunk/complexscripts.html Sun Apr 15 05:39:50 2012
@@ -0,0 +1,701 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <title>Apache™ FOP: Complex Scripts</title>
+
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <meta property="og:image" content="http://www.apache.org/images/asf_logo.gif" />
+<!--
+    <link rel="stylesheet" type="text/css" media="screen" href="http://www.apache.org/css/style.css">
+    <link rel="stylesheet" type="text/css" media="screen" href="http://www.apache.org/css/code.css">
+-->
+    <link href="/css/xmlgraphics.css" rel="stylesheet" type="text/css">
+
+    </style>
+
+    
+
+    
+    
+  </head>
+
+  <body>
+	  <div id="banner">&nbsp;
+	  </div>
+
+	  <div id="navigation">
+	  <h1 id="xml-graphics">XML Graphics</h1>
+<ul>
+<li><a href="/">Overview</a></li>
+<li><a href="/team.html">Who We Are</a></li>
+<li><a href="/legal.html">Legal Stuff</a></li>
+<li><a href="/charter.html">Project Charter</a></li>
+<li><a href="/mail.html">Mailing Lists</a></li>
+<li><a href="/repo.html">Code Repositories</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">ASF Sponsorship Program</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">ASF Thanks</a></li>
+</ul>
+<h1 id="subprojects">Subprojects</h1>
+<ul>
+<li><a href="/batik/">Batik</a></li>
+<li><a href="/fop/">FOP</a></li>
+<li><a href="/commons/">Commons</a></li>
+</ul>
+<form name="search" id="search" action="http://www.google.com/search" method="get">
+  <input value="xmlgraphics.apache.org" name="sitesearch" type="hidden"/>
+  <input type="text" name="q" id="query" /><br />
+  <input type="submit" id="submit" value="Search" />
+</form>
+	  </div>
+	
+	  <div id="bannertext">
+        <a href="/"><img src="/images/apache-xml-graphics.gif" alt="The Apache XML Graphics Project" width="220" heigh="51" /></a>
+        <h1>Apache™ FOP: Complex Scripts</h1>
+      </div>
+        <p><a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/fop/">Fop</a>&nbsp;&raquo&nbsp;<a href="/fop/trunk/">Trunk</a></p>
+      </div>
+      <div id="content" class="grid_16"><div class="section-content"><h1 id="overview">Overview</h1>
+<p>This page describes the <a href="http://en.wikipedia.org/wiki/Complex_scripts">complex scripts</a> features of Apache™ FOP, which include:</p>
+<ul>
+<li>
+<p>Support for languages written with right-to-left scripts, such as Arabic and Hebrew scripts.</p>
+</li>
+<li>
+<p>Support for languages written with South Asian and Southeast Asian scripts, such as Devanagari, Khmer, Tamil, Thai, and others.</p>
+</li>
+<li>
+<p>Support for advanced substitution, reordering, and positioning of glyphs according to language and script sensitive rules.</p>
+</li>
+<li>
+<p>Support for advanced number to string formatting.</p>
+</li>
+</ul>
+<h1 id="disabling-complex-scripts-disablingcomplexscripts">Disabling complex scripts # {#Disabling+complex+scripts}</h1>
+<p>Complex script features are enabled by default. If some application of FOP does not require this support, then it can be disabled in three ways:</p>
+<ol>
+<li>
+<p><strong>Command line:</strong> The command line option <code>-nocs</code> turns off complex script features: <code>fop -nocs -fo mydocument.fo -pdf mydocument.pdf</code> </p>
+</li>
+<li>
+<p><strong>Embedding:</strong>  <code>userAgent.setComplexScriptFeaturesEnabled(false);</code> </p>
+</li>
+<li>
+<p><strong>Optional setting in fop.xconf file:</strong>  <code>&lt;fop version="1.0"&gt;
+  &lt;complex-scripts disabled="true"/&gt;
+  ...
+&lt;/fop&gt;</code> </p>
+</li>
+</ol>
+<p>When complex scripts features are enabled, additional information related to bidirectional level resolution, the association between characters and glyphs, and glyph position adjustments are added to the internal, parsed representation of the XSL-FO tree and its corresponding formatted area tree. This additional information will somewhat increase the memory requirements for processing documents that use these features.
+A document author need not make explicit use of any complex scripts feature in order for this additional information to be created. For example, if the author makes use of a font that contains OpenType GSUB and/or GPOS tables, then those tables will be automatically used unless complex scripts features are disabled.</p>
+<h1 id="source">Changes to your XSL-FO input files</h1>
+<p>In most circumstances, XSL-FO content does not need to change in order to make use of complex scripts features; however, in certain contexts, fully automatic processing is not sufficient. In these cases, an author may make use of the following XSL-FO constructs:</p>
+<ul>
+<li>
+<p>The <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#script"></a> property.</p>
+</li>
+<li>
+<p>The <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#language"></a> property.</p>
+</li>
+<li>
+<p>The <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#writing-mode"></a> property.</p>
+</li>
+<li>
+<p>The number to string conversion properties: <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#format"></a> , <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#grouping-separator"></a> , <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#grouping-size"></a> , <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#letter-value"></a> , and <code>fox:number-conversion-features</code> .</p>
+</li>
+<li>
+<p>The <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#fo_bidi-override"></a> element.</p>
+</li>
+<li>
+<p>Explicit bidirectional control characters: U+200E LRM, U+200F RLM, U+202A LRE, U+202B RLE, U+202C PDF, U+202D LRO, U+202E RLO.</p>
+</li>
+<li>
+<p>Explicit join control characters: U+200C ZWNJ and U+200D ZWJ.</p>
+</li>
+</ul>
+<h1 id="details">Authoring Details</h1>
+<p>The complex scripts related effects of the above enumerated XSL-FO constructs are more fully described in the following sub-sections.</p>
+<h2 id="script_property">Script Property</h2>
+<p>In order to apply font specific complex script features, it is necessary to know the script that applies to the text undergoing layout processing. This script is determined using the following algorithm:</p>
+<ol>
+<li>
+<p>If the FO element that governs the text specifies a <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#script"></a> property and its value is not the empty string or <code>"auto"</code> , then that script is used.</p>
+</li>
+<li>
+<p>Otherwise, the dominant script of the text is determined automatically by finding the script whose constituent characters appear most frequently in the text.</p>
+</li>
+</ol>
+<p>In case the automatic algorithm does not produce the desired results, an author may explicitly specify a <code>script</code> property with the desired script. If specified, it must be one of the four-letter script code specified in <a href="http://unicode.org/iso15924/iso15924-codes.html">ISO 15924 Code List</a> or in the <a href="#extended_script_codes">Extended Script Codes</a> table. Comparison of script codes is performed in a case-insensitive manner, so it does not matter what case is used when specifying these codes in an XSL-FO document.</p>
+<h3 id="standard_script_codes">Standard Script Codes</h3>
+<p>The following table enumerates the standard ISO 15924 4-letter codes recognized by FOP.</p>
+<table>
+<thead>
+<tr>
+<th>Code</th>
+<th>Script</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>arab</code></td>
+<td>Arabic</td>
+</tr>
+<tr>
+<td><code>beng</code></td>
+<td>Bengali</td>
+</tr>
+<tr>
+<td><code>bopo</code></td>
+<td>Bopomofo</td>
+</tr>
+<tr>
+<td><code>cyrl</code></td>
+<td>Cyrillic</td>
+</tr>
+<tr>
+<td><code>deva</code></td>
+<td>Devanagari</td>
+</tr>
+<tr>
+<td><code>ethi</code></td>
+<td>Ethiopic</td>
+</tr>
+<tr>
+<td><code>geor</code></td>
+<td>Georgian</td>
+</tr>
+<tr>
+<td><code>grek</code></td>
+<td>Greek</td>
+</tr>
+<tr>
+<td><code>gujr</code></td>
+<td>Gujarati</td>
+</tr>
+<tr>
+<td><code>guru</code></td>
+<td>Gurmukhi</td>
+</tr>
+<tr>
+<td><code>hang</code></td>
+<td>Hangul</td>
+</tr>
+<tr>
+<td><code>hani</code></td>
+<td>Han</td>
+</tr>
+<tr>
+<td><code>hebr</code></td>
+<td>Hebrew</td>
+</tr>
+<tr>
+<td><code>hira</code></td>
+<td>Hiragana</td>
+</tr>
+<tr>
+<td><code>kana</code></td>
+<td>Katakana</td>
+</tr>
+<tr>
+<td><code>knda</code></td>
+<td>Kannada</td>
+</tr>
+<tr>
+<td><code>khmr</code></td>
+<td>Khmer</td>
+</tr>
+<tr>
+<td><code>laoo</code></td>
+<td>Lao</td>
+</tr>
+<tr>
+<td><code>latn</code></td>
+<td>Latin</td>
+</tr>
+<tr>
+<td><code>mlym</code></td>
+<td>Malayalam</td>
+</tr>
+<tr>
+<td><code>mymr</code></td>
+<td>Burmese</td>
+</tr>
+<tr>
+<td><code>mong</code></td>
+<td>Mongolian</td>
+</tr>
+<tr>
+<td><code>orya</code></td>
+<td>Oriya</td>
+</tr>
+<tr>
+<td><code>sinh</code></td>
+<td>Sinhalese</td>
+</tr>
+<tr>
+<td><code>taml</code></td>
+<td>Tamil</td>
+</tr>
+<tr>
+<td><code>telu</code></td>
+<td>Telugu</td>
+</tr>
+<tr>
+<td><code>thai</code></td>
+<td>Thai</td>
+</tr>
+<tr>
+<td><code>tibt</code></td>
+<td>Tibetan</td>
+</tr>
+<tr>
+<td><code>zmth</code></td>
+<td>Math</td>
+</tr>
+<tr>
+<td><code>zsym</code></td>
+<td>Symbol</td>
+</tr>
+<tr>
+<td><code>zyyy</code></td>
+<td>Undetermined</td>
+</tr>
+<tr>
+<td><code>zzzz</code></td>
+<td>Uncoded</td>
+</tr>
+</tbody>
+</table>
+<h3 id="extended_script_codes">Extended Script Codes</h3>
+<p>The following table enumerates a number of non-standard extended script codes recognized by FOP.</p>
+<table>
+<thead>
+<tr>
+<th><colgrp><col style="width:10%"></col><col style="width:20%"></col><col style="width:80%"></col></colgrp></th>
+<th>Code</th>
+<th>Script</th>
+<th>Comments</th>
+<th></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td></td>
+<td><code>bng2</code></td>
+<td>Bengali</td>
+<td>OpenType Indic Version 2 (May 2008 and following) behavior.</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><code>dev2</code></td>
+<td>Devanagari</td>
+<td>OpenType Indic Version 2 (May 2008 and following) behavior.</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><code>gur2</code></td>
+<td>Gurmukhi</td>
+<td>OpenType Indic Version 2 (May 2008 and following) behavior.</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><code>gjr2</code></td>
+<td>Gujarati</td>
+<td>OpenType Indic Version 2 (May 2008 and following) behavior.</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><code>knd2</code></td>
+<td>Kannada</td>
+<td>OpenType Indic Version 2 (May 2008 and following) behavior.</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><code>mlm2</code></td>
+<td>Malayalam</td>
+<td>OpenType Indic Version 2 (May 2008 and following) behavior.</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><code>ory2</code></td>
+<td>Oriya</td>
+<td>OpenType Indic Version 2 (May 2008 and following) behavior.</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><code>tml2</code></td>
+<td>Tamil</td>
+<td>OpenType Indic Version 2 (May 2008 and following) behavior.</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><code>tel2</code></td>
+<td>Telugu</td>
+<td>OpenType Indic Version 2 (May 2008 and following) behavior.</td>
+<td></td>
+</tr>
+<tr>
+<td><warning>Explicit use of one of the above extended script codes is not portable, and should be limited to use with FOP only.</warning>When performing automatic script determination, FOP selects the OpenType Indic Version 2 script codes by default. If the author requires Version 1 behavior, then an explicit, non-extension script code should be specified in a governing <code>script</code> property.</td>
+<td></td>
+<td></td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td id="language_property">## Language Property</td>
+<td></td>
+<td></td>
+<td></td>
+<td></td>
+</tr>
+</tbody>
+</table>
+<p>Certain fonts that support complex script features can make use of language information in order for language specific processing rules to be applied. For example, a font designed for the Arabic script may support typographic variations according to whether the written language is Arabic, Farsi (Persian), Sindhi, Urdu, or another language written with the Arabic script. In order to apply these language specific features, the author may explicitly mark the text with a <a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#language"></a> property.</p>
+<p>When specifying the <code>language</code> property, the value of the property must be either an <a href="http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes">ISO639-2 3-letter code</a> or an <a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">ISO639-1 2-letter code</a> . Comparison of language codes is performed in a case-insensitive manner, so it does not matter what case is used when specifying these codes in an XSL-FO document.</p>
+<h2 id="writing_mode_property">Writing Mode Property</h2>
+<h2 id="number_conversion_properties">Number Conversion Properties</h2>
+<h2 id="bidi_override_element">Bidi Override Element</h2>
+<h2 id="bidi_controls">Bidi Control Characters</h2>
+<h2 id="join_controls">Join Control Characters</h2>
+<h1 id="supported_scripts">Supported Scripts</h1>
+<p>Support for specific complex scripts is enumerated in the following table. Support for those marked as not being supported is expected to be added in future revisions.</p>
+<table>
+<thead>
+<tr>
+<th><colgrp><col style="width: 15%"></col><col style="width: 10%"></col><col style="width: 10%"></col><col style="width: 65%"></col></colgrp></th>
+<th>Script</th>
+<th>Support</th>
+<th>Tested</th>
+<th>Comments</th>
+<th></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Arabic_alphabet">Arabic</a></td>
+<td>full</td>
+<td>full</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Bengali_alphabet">Bengali</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Burmese_alphabet">Burmese</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Devanagari_alphabet">Devanagari</a></td>
+<td>partial</td>
+<td>partial</td>
+<td>join controls (ZWJ, ZWNJ) not yet supported</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Khmer_alphabet">Khmer</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Gujarati_alphabet">Gujarati</a></td>
+<td>partial</td>
+<td>none</td>
+<td>pre-alpha</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Gurmukhī_alphabet">Gurmukhi</a></td>
+<td>partial</td>
+<td>none</td>
+<td>pre-alpha</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Hebrew_alphabet">Hebrew</a></td>
+<td>full</td>
+<td>partial</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Kannada_alphabet">Kannada</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Lao_alphabet">Lao</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Malayalam_alphabet">Malayalam</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Mongolian_script">Mongolian</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Oriya_script">Oriya</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Tamil_alphabet">Tamil</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Telugu_alphabet">Telugu</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Tibetan_alphabet">Tibetan</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://en.wikipedia.org/wiki/Thai_alphabet">Thai</a></td>
+<td>none</td>
+<td>none</td>
+<td></td>
+<td></td>
+</tr>
+</tbody>
+</table>
+<h1 id="supported_fonts">Supported Fonts</h1>
+<p>Support for specific fonts is enumerated in the following sub-sections. If a given font is not listed, then it has not been tested with these complex scripts features.</p>
+<h2 id="fonts_arabic">Arabic Fonts</h2>
+<table>
+<thead>
+<tr>
+<th><colgrp><col style="width: 15%"></col><col style="width: 10%"></col><col style="width: 10%"></col><col style="width: 65%"></col></colgrp></th>
+<th>Font</th>
+<th>Version</th>
+<th>Glyphs</th>
+<th>Comments</th>
+<th></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/family.aspx?FID=24">Arial Unicode MS</a></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FMID=1081">1.01</a></td>
+<td>50377</td>
+<td>limited GPOS support</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;id=ArabicFonts">Lateef</a></td>
+<td>1.0</td>
+<td>1147</td>
+<td>language features for Kurdish (KUR), Sindhi (SND), Urdu (URD)</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;id=ArabicFonts">Scheherazade</a></td>
+<td>1.0</td>
+<td>1197</td>
+<td>language features for Kurdish (KUR), Sindhi (SND), Urdu (URD)</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/family.aspx?FID=261">Simplified Arabic</a></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FMID=867">1.01</a></td>
+<td></td>
+<td>contains invalid, out of order coverage table entries</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FID=261">Simplified Arabic</a></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FMID=1645">5.00</a></td>
+<td>414</td>
+<td>lacks GPOS support</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FID=261">Simplified Arabic</a></td>
+<td>5.92</td>
+<td>473</td>
+<td>includes GPOS for advanced position adjustment</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/family.aspx?FID=264">Traditional Arabic</a></td>
+<td><a href="http://www.microsoft.com/typography/fonts/family.aspx?FMID=877">1.01</a></td>
+<td>530</td>
+<td>lacks GPOS support</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FID=264">Traditional Arabic</a></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FMID=1658">5.00</a></td>
+<td>530</td>
+<td>lacks GPOS support</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FID=264">Traditional Arabic</a></td>
+<td>5.92</td>
+<td>589</td>
+<td>includes GPOS for advanced position adjustment</td>
+<td></td>
+</tr>
+</tbody>
+</table>
+<h2 id="devanagari_fonts">Devanagari Fonts</h2>
+<table>
+<thead>
+<tr>
+<th><colgrp><col style="width: 15%"></col><col style="width: 10%"></col><col style="width: 10%"></col><col style="width: 65%"></col></colgrp></th>
+<th>Font</th>
+<th>Version</th>
+<th>Glyphs</th>
+<th>Comments</th>
+<th></th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/family.aspx?FID=370">Aparajita</a></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FMID=1700">1.00</a></td>
+<td>706</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/family.aspx?FID=374">Kokila</a></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FMID=1749">1.00</a></td>
+<td>706</td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/family.aspx?FID=243">Mangal</a></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FMID=1759">5.01</a></td>
+<td>885</td>
+<td>designed for use in user interfaces</td>
+<td></td>
+</tr>
+<tr>
+<td></td>
+<td><a href="http://www.microsoft.com/typography/fonts/family.aspx?FID=384">Utsaah</a></td>
+<td><a href="http://www.microsoft.com/typography/fonts/font.aspx?FMID=1811">1.00</a></td>
+<td>706</td>
+<td></td>
+<td></td>
+</tr>
+</tbody>
+</table>
+<h1 id="limitations">Other Limitations</h1>
+<p>Complex scripts support in Apache FOP is relatively new, so there are certain limitations. Please help us identify and close any gaps.</p>
+<ul>
+<li>
+<p>Only the PDF output format fully supports complex scripts features at the present time.</p>
+</li>
+<li>
+<p>Shaping context does not extend across an element boundary. This limitation prevents the use of <code>fo:character</code> , <code>fo:inline</code> or <code>fo:wrapper</code> in order to colorize individual Arabic letters without affecting shaping behavior across the element boundary.</p>
+</li>
+</ul>
+<h1 id="links">Related Links</h1>
+<p>In addition to the XSL-FO specification, a number of external resources provide guidance about authoring documents that employ complex scripts and the features described above:</p>
+<ul>
+<li>
+<p><a href="http://www.unicode.org/">The Unicode Standard</a> </p>
+</li>
+<li>
+<p><a href="http://www.w3.org/TR/2006/REC-xsl11-20061205/#fo_bidi-override">Unicode Bidirectional Algorithm</a> </p>
+</li>
+<li>
+<p><a href="http://www.microsoft.com/typography/otspec/ttochap1.htm">OpenType Advanced Typographic Extensions</a> </p>
+</li>
+<li>
+<p><a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;item_id=CmplxRndExamples">Examples of Complex Rendering</a> </p>
+</li>
+</ul></div></div>
+      <div class="clear"></div>
+
+	  <div id="footer">
+		<a alt="Apache Software Foundation" href="http://www.apache.org">
+		  <img id="asf-logo" alt="Apache Software Foundation" src="/images/feather-small.gif"/ width="100">
+		</a>
+		<div class="copyright">
+		  <p>
+			Copyright &copy; 2011 The Apache Software Foundation, Licensed under
+			the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+			<br />
+			Apache, Apache XML Graphics, the Apache feather logo, and the Apache XML Graphics logos are
+			trademarks of <a href="http://www.apache.org">The Apache Software Foundation</a>. All other
+			marks mentioned may be trademarks or registered trademarks of their respective owners.
+			<br />
+		  </p>
+		</div> 
+	  </div>
+  </body>
+</html>

Added: websites/staging/xmlgraphics/trunk/content/fop/trunk/configuration.html
==============================================================================
--- websites/staging/xmlgraphics/trunk/content/fop/trunk/configuration.html (added)
+++ websites/staging/xmlgraphics/trunk/content/fop/trunk/configuration.html Sun Apr 15 05:39:50 2012
@@ -0,0 +1,375 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <title>Apache™ FOP: Configuration</title>
+
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <meta property="og:image" content="http://www.apache.org/images/asf_logo.gif" />
+<!--
+    <link rel="stylesheet" type="text/css" media="screen" href="http://www.apache.org/css/style.css">
+    <link rel="stylesheet" type="text/css" media="screen" href="http://www.apache.org/css/code.css">
+-->
+    <link href="/css/xmlgraphics.css" rel="stylesheet" type="text/css">
+
+    </style>
+
+    
+
+    
+    
+  </head>
+
+  <body>
+	  <div id="banner">&nbsp;
+	  </div>
+
+	  <div id="navigation">
+	  <h1 id="xml-graphics">XML Graphics</h1>
+<ul>
+<li><a href="/">Overview</a></li>
+<li><a href="/team.html">Who We Are</a></li>
+<li><a href="/legal.html">Legal Stuff</a></li>
+<li><a href="/charter.html">Project Charter</a></li>
+<li><a href="/mail.html">Mailing Lists</a></li>
+<li><a href="/repo.html">Code Repositories</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">ASF Sponsorship Program</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">ASF Thanks</a></li>
+</ul>
+<h1 id="subprojects">Subprojects</h1>
+<ul>
+<li><a href="/batik/">Batik</a></li>
+<li><a href="/fop/">FOP</a></li>
+<li><a href="/commons/">Commons</a></li>
+</ul>
+<form name="search" id="search" action="http://www.google.com/search" method="get">
+  <input value="xmlgraphics.apache.org" name="sitesearch" type="hidden"/>
+  <input type="text" name="q" id="query" /><br />
+  <input type="submit" id="submit" value="Search" />
+</form>
+	  </div>
+	
+	  <div id="bannertext">
+        <a href="/"><img src="/images/apache-xml-graphics.gif" alt="The Apache XML Graphics Project" width="220" heigh="51" /></a>
+        <h1>Apache™ FOP: Configuration</h1>
+      </div>
+        <p><a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/fop/">Fop</a>&nbsp;&raquo&nbsp;<a href="/fop/trunk/">Trunk</a></p>
+      </div>
+      <div id="content" class="grid_16"><div class="section-content"><p><version>$Revision: 1302518 $</version></p>
+<h1 id="general">Configuration File Basics</h1>
+<p>The Apache™ FOP configuration file is an XML file containing a variety of settings that are useful for controlling FOP's behavior, and for helping it find resources that you wish it to use.</p>
+<p>The easiest way to get started using a FOP configuration file is to copy the sample found at <code>{fop-dir}/conf/fop.xconf</code> to a location of your choice, and then to edit it according to your needs. It contains templates for the various configuration options, most of which are commented out. Remove the comments and change the settings for entries that you wish to use. Be sure to follow any instructions, including comments which specify the value range. Also, since the configuration file is XML, be sure to keep it well-formed.</p>
+<h2 id="general-available">Making Configuration Available to FOP</h2>
+<p>After creating your configuration file, you must tell FOP how to find it:</p>
+<ul>
+<li>
+<p>If running FOP from the command-line, see the "-c" command-line option in <a href="running.html">Running FOP</a> .</p>
+</li>
+<li>
+<p>If running FOP as an embedded application, see <a href="embedding.html#config-external">Embedding, Using a Configuration File</a> .</p>
+</li>
+</ul>
+<p>See <a href="embedding.html#config-internal">Setting the Configuration Programmatically</a> for instructions on how to do so in an embedded environment.</p>
+<h1 id="general-elements">Summary of the General Configuration Options</h1>
+<table>
+<thead>
+<tr>
+<th>Element</th>
+<th>Data Type (for the value)</th>
+<th>Description</th>
+<th>Default Value</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>base</td>
+<td>URL or directory</td>
+<td>Specifies the base URL based on which relative URL will be resolved.</td>
+<td>current directory</td>
+</tr>
+<tr>
+<td>font-base</td>
+<td>URL or directory</td>
+<td>Specifies the base URL based on which relative font URLs will be resolved.</td>
+<td>base URL/directory (above)</td>
+</tr>
+<tr>
+<td>hyphenation-base</td>
+<td>URL or directory</td>
+<td>Specifies the base URL based on which relative URLs to hyphenation pattern files will be resolved. If not specified, support for user-supplied hyphenation patterns remains disabled.</td>
+<td>disabled</td>
+</tr>
+<tr>
+<td>Relative URIs for the above three properties are evaluated relative to the base URI of the configuration file. If the configuration is provided programmatically, the base URI can be set with <code>FopFactory.setUserConfigBaseURI</code> ; default is the current working directory.</td>
+<td></td>
+<td></td>
+<td></td>
+</tr>
+<tr>
+<td>hyphenation-pattern</td>
+<td>String, attribute lang, attribute country (optional)</td>
+<td>Register a file name for the hyphenation pattern for the mentioned language and country. Language ll and country CC must both consist of two letters.</td>
+<td>ll_CC</td>
+</tr>
+<tr>
+<td>source-resolution</td>
+<td>Integer, dpi</td>
+<td>Resolution in dpi (dots per inch) which is used internally to determine the pixel size for SVG images and bitmap images without resolution information.</td>
+<td>72 dpi</td>
+</tr>
+<tr>
+<td>target-resolution</td>
+<td>Integer, dpi</td>
+<td>Resolution in dpi (dots per inch) used to specify the output resolution for bitmap images generated by bitmap renderers (such as the TIFF renderer) and by bitmaps generated by Apache Batik for filter effects and such.</td>
+<td>72 dpi</td>
+</tr>
+<tr>
+<td>strict-configuration</td>
+<td>Boolean (true, false)</td>
+<td>Setting this option to 'true' will cause FOP to strictly verify the contents of the FOP configuration file to ensure that defined resources (such as fonts and base URLs/directories) are valid and available to FOP. Any errors found will cause FOP to immediately raise an exception.</td>
+<td>false</td>
+</tr>
+<tr>
+<td>strict-validation</td>
+<td>Boolean (true, false)</td>
+<td>Setting this option to 'false' causes FOP to be more forgiving about XSL-FO validity, for example, you're allowed to specify a border on a region-body which is supported by some FO implementations but is non-standard. Note that such a border would currently have no effect in Apache FOP.</td>
+<td>true</td>
+</tr>
+<tr>
+<td>break-indent-inheritance</td>
+<td>Boolean (true, false)</td>
+<td>Setting this option to 'true' causes FOP to use an alternative rule set to determine text indents specified through margins, start-indent and end-indent. Many commercial FO implementations have chosen to break the XSL specification in this aspect. This option tries to mimic their behaviour. Please note that Apache FOP may still not behave exactly like those implementations either because FOP has not fully matched the desired behaviour and because the behaviour among the commercial implementations varies. The default for this option (i.e. false) is to behave exactly like the specification describes.</td>
+<td>false</td>
+</tr>
+<tr>
+<td>complex-scripts</td>
+<td>attribute disabled (optional)</td>
+<td>If present and if an attribute 'disabled' is specified with the value 'false', then complex script features are disabled. The same result can be obtained on an FOP per-invocation basis by specifying a '-nocs' command line option when invoking FOP. When complex script features are disabled, all bidirectional processing and complex character to glyph mapping processing is disabled; in addition, the loading of GDEF, GSUB, and GPOS advanced typographic tables is disabled for OpenType and TrueType fonts. Unless disabled by this mechanism or by use of the '-nocs' command line option, complex script features will be enabled by default.</td>
+<td>n/a</td>
+</tr>
+<tr>
+<td>default-page-settings</td>
+<td>n/a</td>
+<td>Specifies the default width and height of a page if "auto" is specified for either or both values. Use "height" and "width" attributes on the default-page-settings element to specify the two values.</td>
+<td>"height" 11 inches, "width" 8.26 inches</td>
+</tr>
+<tr>
+<td>use-cache</td>
+<td>boolean (true, false)</td>
+<td>All fonts information that has been gathered as a result of "directory" or "auto-detect" font configurations will be cached for future rendering runs. This setting should improve performance on systems where fonts have been configured using the "directory" or "auto-detect" tag mechanisms. By default this option is switched on.</td>
+<td>true</td>
+</tr>
+<tr>
+<td>cache-file</td>
+<td>String</td>
+<td>This option specifies the file/directory path of the fop cache file. This file is currently only used to cache font triplet information for future reference.</td>
+<td>${base}/conf/fop.cache</td>
+</tr>
+<tr>
+<td>renderers</td>
+<td>(see text below)</td>
+<td>Contains the configuration for each renderer. See below.</td>
+<td>N/A</td>
+</tr>
+</tbody>
+</table>
+<p>This is an excerpt from the example configuration file coming with FOP:</p>
+<p><fop version="1.0"></p>
+<p><!-- Strict user configuration -->
+  <strict-configuration>true</strict-configuration></p>
+<p><!-- Strict FO validation -->
+  <strict-validation>true</strict-validation></p>
+<p><!-- Base URL for resolving relative URLs -->
+  <base>./</base></p>
+<p><!-- Font Base URL for resolving relative font URLs -->
+  <font-base>./</font-base></p>
+<p><!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi -->
+  <source-resolution>72</source-resolution>
+  <!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
+  <target-resolution>72</target-resolution></p>
+<p><!-- default page-height and page-width, in case
+       value is specified as auto -->
+  <default-page-settings height="11in" width="8.26in"/></p>
+<p><!-- Use file name nl_Bel instead of the default nl_BE -->
+  <hyphenation-pattern lang="nl" country="BE">nl_Bel</hyphenation-pattern></p>
+<p><!-- etc. etc..... -->
+</fop></p>
+<h1 id="image-loading">Image Loading Customization</h1>
+<p>Apache FOP uses the image loading framework from <a href="http://xmlgraphics.apache.org/commons/">Apache XML Graphics Commons</a> to load images using various plug-ins. Every image loader plug-in has a hard-coded usage penalty that influences which solution is chosen if there are multiple possibilities to load an image. Sometimes, though, these penalties need to be tweaked and this can be done in the FOP configuration. An example:
+<fop version="1.0">
+  [..]
+  <image-loading>
+    <penalty value="10000"
+      class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderRawCCITTFax"/>
+    <penalty value="INFINITE"
+      class="org.apache.xmlgraphics.image.loader.impl.ImageLoaderInternalTIFF"/>
+  </image-loading>
+  <renderers....
+</fop>
+The first penalty element increases the penalty for the raw CCITT loader. This practically forces the decoding of CCITT compressed TIFF images except if there are no TIFF codecs available.</p>
+<p>The second penalty element sets an "infinite" penalty for the TIFF loader using the internal TIFF codec. This practically disables that plug-in as it will never be chosen as a possible solution.</p>
+<p>Negative penalties are possible to promote a plug-in but a negative penalty sum will be treated as zero penalty in most cases. For more details on the image loading framework, please consult the documentation there.</p>
+<h1 id="renderers">Renderer configuration</h1>
+<p>Each Renderer has its own configuration section which is identified by the MIME type the Renderer is written for, ex. "application/pdf" for the PDF Renderer.</p>
+<p>The configuration for the PDF Renderer could look like this:</p>
+<p><renderers>
+    <renderer mime="application/pdf">
+      <filterList>
+        <!-- provides compression using zlib flate (default is on) -->
+        <value>flate</value>
+      </filterList>
+      <fonts>
+        <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
+          <font-triplet name="Arial" style="normal" weight="normal"/>
+          <font-triplet name="ArialMT" style="normal" weight="normal"/>
+        </font>
+        <font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf">
+          <font-triplet name="Arial" style="normal" weight="bold"/>
+          <font-triplet name="ArialMT" style="normal" weight="bold"/>
+        </font>
+      </fonts>
+    </renderer></p>
+<div class="codehilite"><pre><span class="o">&lt;</span><span class="n">renderer</span> <span class="n">mime</span><span class="o">=</span><span class="s">&quot;application/postscript&quot;</span><span class="o">&gt;</span>
+<span class="o">&lt;!--</span> <span class="n">etc</span><span class="o">.</span> <span class="n">etc</span><span class="o">.....</span> <span class="o">--&gt;</span>
+</pre></div>
+
+
+<p>The details on the font configuration can be found on the separate <a href="fonts.html">Fonts</a> page. Note especially the section entitled <a href="fonts.html#register">Register Fonts with FOP</a> .</p>
+<h2 id="pdf-renderer">Special Settings for the PDF Renderer</h2>
+<p>The configuration element for the PDF renderer contains two elements. One is for the font configuration (please follow the link above) and one is for the "filter list". The filter list controls how the individual objects in a PDF file are encoded. By default, all objects get "flate" encoded (i.e. simply compressed with the same algorithm that is also used in ZIP files). Most users don't need to change that setting. For debugging purposes, it may be desired not to compress the internal objects at all so the generated PDF commands can be read. In that case, you can simply use the following filter list. The second filter list (type="image") ensures that all images still get compressed but also ASCII-85 encoded so the produced PDF file is still easily readable in a text editor.</p>
+<div class="codehilite"><pre><span class="nt">&lt;renderer</span> <span class="na">mime=</span><span class="s">&quot;application/pdf&quot;</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;filterList&gt;</span>
+    <span class="nt">&lt;value&gt;</span>null<span class="nt">&lt;/value&gt;</span>
+  <span class="nt">&lt;/filterList&gt;</span>
+  <span class="nt">&lt;filterList</span> <span class="na">type=</span><span class="s">&quot;image&quot;</span><span class="nt">&gt;</span>
+    <span class="nt">&lt;value&gt;</span>flate<span class="nt">&lt;/value&gt;</span>
+    <span class="nt">&lt;value&gt;</span>ascii-85<span class="nt">&lt;/value&gt;</span>
+  <span class="nt">&lt;/filterList&gt;</span>
+
+  <span class="nt">&lt;fonts....</span>
+<span class="err">&lt;/renderer</span><span class="nt">&gt;</span>
+</pre></div>
+
+
+<p>Another (optional) setting specific to the PDF Renderer is an output color profile, an ICC color profile which indicates the target color space the PDF file is generated for. This setting is mainly used in conjunction with the <a href="pdfx.html">PDF/X</a> feature. An example:</p>
+<div class="codehilite"><pre><span class="nt">&lt;renderer</span> <span class="na">mime=</span><span class="s">&quot;application/pdf&quot;</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;filterList...</span>
+
+  <span class="err">&lt;output-profile</span><span class="nt">&gt;</span>C:\FOP\Color\EuropeISOCoatedFOGRA27.icc<span class="nt">&lt;/output-profile&gt;</span>
+
+  <span class="nt">&lt;fonts....</span>
+  <span class="err">&lt;/renderer</span><span class="nt">&gt;</span>
+</pre></div>
+
+
+<p>Some people don't have high requirements on color fidelity but instead want the smallest PDF file sizes possible. In this case it's possible to disable the default sRGB color space which XSL-FO requires. This will cause RGB colors to be generated as device-specific RGB. Please note that this option is unavailable (and will cause an error) if you enable PDF/A or PDF/X functionality or if you specify an output profile. This setting will make the PDF about 4KB smaller. To disable the sRGB color space add the following setting:</p>
+<div class="codehilite"><pre><span class="nt">&lt;renderer</span> <span class="na">mime=</span><span class="s">&quot;application/pdf&quot;</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;filterList...</span>
+
+  <span class="err">&lt;disable-srgb-colorspace</span><span class="nt">&gt;</span>true<span class="nt">&lt;/disable-srgb-colorspace&gt;</span>
+
+  <span class="nt">&lt;fonts....</span>
+  <span class="err">&lt;/renderer</span><span class="nt">&gt;</span>
+</pre></div>
+
+
+<p>FOP supports encryption of PDF output, thanks to Patrick C. Lankswert. This feature is commonly used to prevent unauthorized viewing, printing, editing, copying text from the document and doing annotations. It is also possible to ask the user for a password in order to view the contents. Note that there already exist third party applications which can decrypt an encrypted PDF without effort and allow the aforementioned operations, therefore the degree of protection is limited. For further information about features and restrictions regarding PDF encryption, look at the documentation coming with Adobe Acrobat or the technical documentation on the Adobe web site.</p>
+<div class="codehilite"><pre><span class="nt">&lt;renderer</span> <span class="na">mime=</span><span class="s">&quot;application/pdf&quot;</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;encryption-params&gt;</span>
+     <span class="nt">&lt;encryption-length&gt;</span>128<span class="nt">&lt;/encryption-length&gt;</span>
+     <span class="nt">&lt;user-password&gt;</span>testuserpass<span class="nt">&lt;/user-password&gt;</span>
+     <span class="nt">&lt;owner-password&gt;</span>testownerpass<span class="nt">&lt;/owner-password&gt;</span>
+     <span class="nt">&lt;noprint/&gt;</span>
+     <span class="nt">&lt;nocopy/&gt;</span>
+     <span class="nt">&lt;noedit/&gt;</span>
+     <span class="nt">&lt;noannotations/&gt;</span>
+     <span class="nt">&lt;nofillinforms/&gt;</span>
+     <span class="nt">&lt;noaccesscontent/&gt;</span>
+     <span class="nt">&lt;noassembledoc/&gt;</span>
+     <span class="nt">&lt;noprinthq/&gt;</span>
+  <span class="nt">&lt;/encryption-params&gt;</span>
+<span class="nt">&lt;/renderer&gt;</span>
+</pre></div>
+
+
+<p>By default FOP produces PDF files of version 1.4, but this can be changed in order to benefit from features that appeared in newer versions of PDF. At the moment, only a few features from PDF 1.5 have been implemented, but the configuration element will accept any value between 1.4 and 1.7. This is the value that will appear in the PDF header, although only features up to 1.5 will actually be used.
+      <renderer mime="application/pdf">
+        <version>1.5</version>
+        <!-- Versions 1.4, 1.5, 1.6 and 1.7 are accepted, all other values are invalid -->
+      </renderer></p>
+<h2 id="ps-renderer">Special Settings for the PostScript Renderer</h2>
+<p>Besides the normal font configuration (the same "fonts" element as for the PDF renderer) the PostScript renderer has an additional setting to force landscape pages to be rotated to fit on a page inserted into the printer in portrait mode. Set the value to "true" to activate this feature. The default is "false". Example:</p>
+<div class="codehilite"><pre><span class="nt">&lt;renderer</span> <span class="na">mime=</span><span class="s">&quot;application/postscript&quot;</span><span class="nt">&gt;</span>
+  <span class="nt">&lt;auto-rotate-landscape&gt;</span>true<span class="nt">&lt;/auto-rotate-landscape&gt;</span>
+
+  <span class="nt">&lt;fonts&gt;</span>
+    <span class="nt">&lt;font</span> <span class="na">metrics-url=</span><span class="s">&quot;arial.xml&quot;</span> <span class="na">kerning=</span><span class="s">&quot;yes&quot;</span> <span class="na">embed-url=</span><span class="s">&quot;arial.ttf&quot;</span><span class="nt">&gt;</span>
+      <span class="nt">&lt;font-triplet</span> <span class="na">name=</span><span class="s">&quot;Arial&quot;</span> <span class="na">style=</span><span class="s">&quot;normal&quot;</span> <span class="na">weight=</span><span class="s">&quot;normal&quot;</span><span class="nt">/&gt;</span>
+      <span class="nt">&lt;font-triplet</span> <span class="na">name=</span><span class="s">&quot;ArialMT&quot;</span> <span class="na">style=</span><span class="s">&quot;normal&quot;</span> <span class="na">weight=</span><span class="s">&quot;normal&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;/font&gt;</span>
+    <span class="nt">&lt;font</span> <span class="na">metrics-url=</span><span class="s">&quot;arialb.xml&quot;</span> <span class="na">kerning=</span><span class="s">&quot;yes&quot;</span> <span class="na">embed-url=</span><span class="s">&quot;arialb.ttf&quot;</span><span class="nt">&gt;</span>
+      <span class="nt">&lt;font-triplet</span> <span class="na">name=</span><span class="s">&quot;Arial&quot;</span> <span class="na">style=</span><span class="s">&quot;normal&quot;</span> <span class="na">weight=</span><span class="s">&quot;bold&quot;</span><span class="nt">/&gt;</span>
+      <span class="nt">&lt;font-triplet</span> <span class="na">name=</span><span class="s">&quot;ArialMT&quot;</span> <span class="na">style=</span><span class="s">&quot;normal&quot;</span> <span class="na">weight=</span><span class="s">&quot;bold&quot;</span><span class="nt">/&gt;</span>
+    <span class="nt">&lt;/font&gt;</span>
+  <span class="nt">&lt;/fonts&gt;</span>
+<span class="nt">&lt;/renderer&gt;</span>
+</pre></div>
+
+
+<h2 id="pcl-renderer">Special Settings for the PCL Renderer</h2>
+<p>Non-standard fonts for the PCL renderer are made available through the Java2D subsystem which means that you don't have to do any custom font configuration in this case but you have to use the font names offered by Java.</p>
+<p>Additionally, there are certain settings that control how the renderer handles various elements.
+<renderer mime="application/vnd.hp-PCL">
+  <rendering>quality</rendering>
+  <text-rendering>bitmap</text-rendering>
+</renderer>
+The default value for the "rendering" setting is "speed" which causes borders to be painted as plain rectangles. In this mode, no special borders (dotted, dashed etc.) are available. If you want support for all border modes, set the value to "quality" as indicated above. This will cause the borders to be painted as bitmaps.</p>
+<p>The default value for the "text-rendering" setting is "auto" which paints the base fonts using PCL fonts. Non-base fonts are painted as bitmaps through Java2D. If the mix of painting methods results in unwelcome output, you can set this to "bitmap" which causes all text to be rendered as bitmaps.</p>
+<h2 id="afp-renderer">Special Settings for the AFP Renderer</h2>
+<p>Additionally, there are certain settings that control how the renderer handles various elements.
+<renderer mime="application/x-afp">
+  <images mode="b+w" bits-per-pixel="8" native="true"/>
+  <renderer-resolution>240</renderer-resolution></p>
+<p><!-- a default external resource group file -->
+  <resource-group-file>resources.afp</resource-group-file>
+</renderer>
+The default value for the images "mode" setting is "b+w" (black and white). When the images "mode" setting is "b+w" a "bits-per-pixel" setting can be provided to aid the grayscale conversion process. With this setting all images referenced in your source document are converted to an IOCA FS45 grayscale bitmap image form. When the setting is "color" all images are converted to an IOCA FS45 color bitmap image form. When "native" setting is "true", all images encountered (TIFF, GIF, JPEG and Encapsulated Postscript etc.) will be embedded directly in the datastream in their native form using a MO:DCA Object Container.</p>
+<p>The default value for the "renderer-resolution" is 240 dpi.</p>
+<p>By default if there is no configuration definition for "resource-group-file", external resources will be placed in a file called resources.afp.</p>
+<h1 id="when-it-does-not-work-whenitdoesnotwork">When it does not work # {#When+it+does+not+work}</h1>
+<p>FOP searches the configuration file for the information it expects, at the position it expects. When that information is not present, FOP will not complain, it will just continue. When there is other information in the file, FOP will not complain, it will just ignore it. That means that when your configuration information is in the file but in a different XML element, or in a different XML path, than FOP expects, it will be silently ignored.</p>
+<p>Check the following possibilities:</p>
+<ul>
+<li>
+<p>The format of the configuration file has changed considerably between FOP 0.20.5 and FOP 1.0 and its beta versions. Did you convert your file to the new format?</p>
+</li>
+<li>
+<p>The FOP distribution contains a schema for configuration files, at src/foschema/fop-configuration.xsd. Did you validate your configuration file against it? Add the following schema location to the <code>schema</code> element:<fop
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:noNamespaceSchemaLocation=
+"http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co">
+and run the configuration file through a validating schema parser. Note that the schema cannot detect all errors, and that it is stricter about the order of some elements than FOP itself is.</p>
+</li>
+<li>
+<p>Run FOP in debug mode (command line option <code>-d</code> ). This makes FOP report which configuration information it finds. Check if FOP finds what you expect.</p>
+</li>
+</ul></div></div>
+      <div class="clear"></div>
+
+	  <div id="footer">
+		<a alt="Apache Software Foundation" href="http://www.apache.org">
+		  <img id="asf-logo" alt="Apache Software Foundation" src="/images/feather-small.gif"/ width="100">
+		</a>
+		<div class="copyright">
+		  <p>
+			Copyright &copy; 2011 The Apache Software Foundation, Licensed under
+			the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+			<br />
+			Apache, Apache XML Graphics, the Apache feather logo, and the Apache XML Graphics logos are
+			trademarks of <a href="http://www.apache.org">The Apache Software Foundation</a>. All other
+			marks mentioned may be trademarks or registered trademarks of their respective owners.
+			<br />
+		  </p>
+		</div> 
+	  </div>
+  </body>
+</html>

Added: websites/staging/xmlgraphics/trunk/content/fop/trunk/embedding.html
==============================================================================
--- websites/staging/xmlgraphics/trunk/content/fop/trunk/embedding.html (added)
+++ websites/staging/xmlgraphics/trunk/content/fop/trunk/embedding.html Sun Apr 15 05:39:50 2012
@@ -0,0 +1,372 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+  <head>
+    <title>Apache™ FOP: Embedding</title>
+
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <meta property="og:image" content="http://www.apache.org/images/asf_logo.gif" />
+<!--
+    <link rel="stylesheet" type="text/css" media="screen" href="http://www.apache.org/css/style.css">
+    <link rel="stylesheet" type="text/css" media="screen" href="http://www.apache.org/css/code.css">
+-->
+    <link href="/css/xmlgraphics.css" rel="stylesheet" type="text/css">
+
+    </style>
+
+    
+
+    
+    
+  </head>
+
+  <body>
+	  <div id="banner">&nbsp;
+	  </div>
+
+	  <div id="navigation">
+	  <h1 id="xml-graphics">XML Graphics</h1>
+<ul>
+<li><a href="/">Overview</a></li>
+<li><a href="/team.html">Who We Are</a></li>
+<li><a href="/legal.html">Legal Stuff</a></li>
+<li><a href="/charter.html">Project Charter</a></li>
+<li><a href="/mail.html">Mailing Lists</a></li>
+<li><a href="/repo.html">Code Repositories</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">ASF Sponsorship Program</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">ASF Thanks</a></li>
+</ul>
+<h1 id="subprojects">Subprojects</h1>
+<ul>
+<li><a href="/batik/">Batik</a></li>
+<li><a href="/fop/">FOP</a></li>
+<li><a href="/commons/">Commons</a></li>
+</ul>
+<form name="search" id="search" action="http://www.google.com/search" method="get">
+  <input value="xmlgraphics.apache.org" name="sitesearch" type="hidden"/>
+  <input type="text" name="q" id="query" /><br />
+  <input type="submit" id="submit" value="Search" />
+</form>
+	  </div>
+	
+	  <div id="bannertext">
+        <a href="/"><img src="/images/apache-xml-graphics.gif" alt="The Apache XML Graphics Project" width="220" heigh="51" /></a>
+        <h1>Apache™ FOP: Embedding</h1>
+      </div>
+        <p><a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/fop/">Fop</a>&nbsp;&raquo&nbsp;<a href="/fop/trunk/">Trunk</a></p>
+      </div>
+      <div id="content" class="grid_16"><div class="section-content"><p><subtitle>How to Embed FOP in a Java application</subtitle><version>$Revision: 1298724 $</version></p>
+<h1 id="overview">Overview</h1>
+<p>Review <a href="running.html">Running Apache™ FOP</a> for important information that applies to embedded applications as well as command-line use, such as options and performance.</p>
+<p>To embed Apache™ FOP in your application, first create a new org.apache.fop.apps.FopFactory instance. This object can be used to launch multiple rendering runs. For each run, create a new org.apache.fop.apps.Fop instance through one of the factory methods of FopFactory. In the method call you specify which output format (i.e. MIME type) to use and, if the selected output format requires an OutputStream, which OutputStream to use for the results of the rendering. You can customize FOP's behaviour in a rendering run by supplying your own FOUserAgent instance. The FOUserAgent can, for example, be used to set your own document handler instance (details below). Finally, you retrieve a SAX DefaultHandler instance from the Fop object and use that as the SAXResult of your transformation.</p>
+<h1 id="API">The API</h1>
+<p>FOP has many classes which express the "public" access modifier, however, this is not indicative of their inclusion into the public API. Every attempt will be made to keep the public API static, to minimize regressions for existing users, however, since the API is not clearly defined, the list of classes below are the generally agreed public API:
+org.apache.fop.apps.*
+org.apache.fop.fo.FOEventHandler
+org.apache.fop.fo.ElementMappingRegistry
+org.apache.fop.fonts.FontManager
+org.apache.fop.events.EventListener
+org.apache.fop.events.Event
+org.apache.fop.events.model.EventSeverity
+org.apache.fop.render.ImageHandlerRegistry
+org.apache.fop.render.RendererFactory
+org.apache.fop.render.intermediate.IFContext
+org.apache.fop.render.intermediate.IFDocumentHandler
+org.apache.fop.render.intermediate.IFException
+org.apache.fop.render.intermediate.IFParser
+org.apache.fop.render.intermediate.IFSerializer
+org.apache.fop.render.intermediate.IFUtil
+org.apache.fop.render.intermediate.util.IFConcatenator</p>
+<h1 id="basics">Basic Usage Pattern</h1>
+<p>Apache FOP relies heavily on JAXP. It uses SAX events exclusively to receive the XSL-FO input document. It is therefore a good idea that you know a few things about JAXP (which is a good skill anyway). Let's look at the basic usage pattern for FOP...</p>
+<p>Here is the basic pattern to render an XSL-FO file to PDF:</p>
+<p>import org.apache.fop.apps.FopFactory;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.MimeConstants;</p>
+<p>/<em>..</em>/</p>
+<p>// Step 1: Construct a FopFactory
+// (reuse if you plan to render multiple documents!)
+FopFactory fopFactory = FopFactory.newInstance();</p>
+<p>// Step 2: Set up output stream.
+// Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
+OutputStream out = new BufferedOutputStream(new FileOutputStream(new File("C:/Temp/myfile.pdf")));</p>
+<p>try {
+  // Step 3: Construct fop with desired output format
+  Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);</p>
+<p>// Step 4: Setup JAXP using identity transformer
+  TransformerFactory factory = TransformerFactory.newInstance();
+  Transformer transformer = factory.newTransformer(); // identity transformer</p>
+<p>// Step 5: Setup input and output for XSLT transformation
+  // Setup input stream
+  Source src = new StreamSource(new File("C:/Temp/myfile.fo"));</p>
+<p>// Resulting SAX events (the generated FO) must be piped through to FOP
+  Result res = new SAXResult(fop.getDefaultHandler());</p>
+<p>// Step 6: Start XSLT transformation and FOP processing
+  transformer.transform(src, res);</p>
+<p>} finally {
+  //Clean-up
+  out.close();
+}
+Let's discuss these 5 steps in detail:</p>
+<ul>
+<li>
+<p><strong>Step 1:</strong> You create a new FopFactory instance. The FopFactory instance holds references to configuration information and cached data. It's important to reuse this instance if you plan to render multiple documents during a JVM's lifetime.</p>
+</li>
+<li>
+<p><strong>Step 2:</strong> You set up an OutputStream that the generated document will be written to. It's a good idea to buffer the OutputStream as demonstrated to improve performance.</p>
+</li>
+<li>
+<p><strong>Step 3:</strong> You create a new Fop instance through one of the factory methods on the FopFactory. You tell the FopFactory what your desired output format is. This is done by using the MIME type of the desired output format (ex. "application/pdf"). You can use one of the MimeConstants.* constants. The second parameter is the OutputStream you've setup up in step 2.</p>
+</li>
+<li>
+<p><strong>Step 4</strong> We recommend that you use JAXP Transformers even if you don't do XSLT transformations to generate the XSL-FO file. This way you can always use the same basic pattern. The example here sets up an "identity transformer" which just passes the input (Source) unchanged to the output (Result). You don't have to work with a SAXParser if you don't do any XSLT transformations.</p>
+</li>
+<li>
+<p><strong>Step 5:</strong> Here you set up the input and output for the XSLT transformation. The Source object is set up to load the "myfile.fo" file. The Result is set up so the output of the XSLT transformation is sent to FOP. The FO file is sent to FOP in the form of SAX events which is the most efficient way. Please always avoid saving intermediate results to a file or a memory buffer because that affects performance negatively.</p>
+</li>
+<li>
+<p><strong>Step 6:</strong> Finally, we start the XSLT transformation by starting the JAXP Transformer. As soon as the JAXP Transformer starts to send its output to FOP, FOP itself starts its processing in the background. When the <code>transform()</code> method returns FOP will also have finished converting the FO file to a PDF file and you can close the OutputStream.It's a good idea to enclose the whole conversion in a try..finally statement. If you close the OutputStream in the finally section, this will make sure that the OutputStream is properly closed even if an exception occurs during the conversion.</p>
+</li>
+</ul>
+<p>If you're not totally familiar with JAXP Transformers, please have a look at the <a href="#examples">Embedding examples</a> below. The section contains examples for all sorts of use cases. If you look at all of them in turn you should be able to see the patterns in use and the flexibility this approach offers without adding too much complexity.</p>
+<p>This may look complicated at first, but it's really just the combination of an XSL transformation and a FOP run. It's also easy to comment out the FOP part for debugging purposes, for example when you're tracking down a bug in your stylesheet. You can easily write the XSL-FO output from the XSL transformation to a file to check if that part generates the expected output. An example for that can be found in the <a href="#examples">Embedding examples</a> (See "ExampleXML2FO").</p>
+<h2 id="basic-logging">Logging</h2>
+<p>Logging is now a little different than it was in FOP 0.20.5. We've switched from Avalon Logging to <a href="http://commons.apache.org/logging/">Jakarta Commons Logging</a> . While with Avalon Logging the loggers were directly given to FOP, FOP now retrieves its logger(s) through a statically available LogFactory. This is similar to the general pattern that you use when you work with Apache Log4J directly, for example. We call this "static logging" (Commons Logging, Log4J) as opposed to "instance logging" (Avalon Logging). This has a consequence: You can't give FOP a logger for each processing run anymore. The log output of multiple, simultaneously running FOP instances is sent to the same logger.</p>
+<p>By default, <a href="http://commons.apache.org/logging/">Jakarta Commons Logging</a> uses JDK logging (available in JDKs 1.4 or higher) as its backend. You can configure Commons Logging to use an alternative backend, for example Log4J. Please consult the <a href="http://commons.apache.org/logging/">documentation for Jakarta Commons Logging</a> on how to configure alternative backends.</p>
+<p>As a result of the above we differentiate between two kinds of "logging":</p>
+<ul>
+<li>
+<p>(FOP-)Developer-oriented logging</p>
+</li>
+<li>
+<p><a href="events.html">User/Integrator-oriented feedback</a> (NEW!)</p>
+</li>
+</ul>
+<p>The use of "feedback" instead of "logging" is intentional. Most people were using log output as a means to get feedback from events within FOP. Therefore, FOP now includes an <code>event</code> package which can be used to receive feedback from the layout engine and other components within FOP <strong>per rendering run</strong> . This feedback is not just some text but event objects with parameters so these events can be interpreted by code. Of course, there is a facility to turn these events into normal human-readable messages. For details, please read on on the <a href="events.html">Events page</a> . This leaves normal logging to be mostly a thing used by the FOP developers although anyone can surely activate certain logging categories but the feedback from the loggers won't be separated by processing runs. If this is required, the <a href="events.html">Events subsystem</a> is the right approach.</p>
+<h2 id="render">Processing XSL-FO</h2>
+<p>Once the Fop instance is set up, call <code>getDefaultHandler()</code> to obtain a SAX DefaultHandler instance to which you can send the SAX events making up the XSL-FO document you'd like to render. FOP processing starts as soon as the DefaultHandler's <code>startDocument()</code> method is called. Processing stops again when the DefaultHandler's <code>endDocument()</code> method is called. Please refer to the basic usage pattern shown above to render a simple XSL-FO document.</p>
+<h2 id="render-with-xslt">Processing XSL-FO generated from XML+XSLT</h2>
+<p>If you want to process XSL-FO generated from XML using XSLT we recommend again using standard JAXP to do the XSLT part and piping the generated SAX events directly through to FOP. The only thing you'd change to do that on the basic usage pattern above is to set up the Transformer differently:</p>
+<p>//without XSLT:
+  //Transformer transformer = factory.newTransformer(); // identity transformer</p>
+<p>//with XSLT:
+  Source xslt = new StreamSource(new File("mystylesheet.xsl"));
+  Transformer transformer = factory.newTransformer(xslt);</p>
+<h1 id="input">Input Sources</h1>
+<p>The input XSL-FO document is always received by FOP as a SAX stream (see the <a href="../dev/design/parsing.html">Parsing Design Document</a> for the rationale).</p>
+<p>However, you may not always have your input document available as a SAX stream. But with JAXP it's easy to convert different input sources to a SAX stream so you can pipe it into FOP. That sounds more difficult than it is. You simply have to set up the right Source instance as input for the JAXP transformation. A few examples:</p>
+<ul>
+<li>
+<p><strong>URL:</strong>  <code>Source src = new StreamSource("http://localhost:8080/testfile.xml");</code> </p>
+</li>
+<li>
+<p><strong>File:</strong>  <code>Source src = new StreamSource(new File("C:/Temp/myinputfile.xml"));</code> </p>
+</li>
+<li>
+<p><strong>String:</strong>  <code>Source src = new StreamSource(new StringReader(myString)); // myString is a String</code> </p>
+</li>
+<li>
+<p><strong>InputStream:</strong>  <code>Source src = new StreamSource(new MyInputStream(something));</code> </p>
+</li>
+<li>
+<p><strong>Byte Array:</strong>  <code>Source src = new StreamSource(new ByteArrayInputStream(myBuffer)); // myBuffer is a byte[] here</code> </p>
+</li>
+<li>
+<p><strong>DOM:</strong>  <code>Source src = new DOMSource(myDocument); // myDocument is a Document or a Node</code> </p>
+</li>
+<li>
+<p><strong>Java Objects:</strong> Please have a look at the <a href="#examples">Embedding examples</a> which contain an example for this.</p>
+</li>
+</ul>
+<p>There are a variety of upstream data manipulations possible. For example, you may have a DOM and an XSL stylesheet; or you may want to set variables in the stylesheet. Interface documentation and some cookbook solutions to these situations are provided in <a href="http://xml.apache.org/xalan-j/usagepatterns.html">Xalan Basic Usage Patterns</a> .</p>
+<h1 id="config-internal">Configuring Apache FOP Programmatically</h1>
+<p>Apache FOP provides two levels on which you can customize FOP's behaviour: the FopFactory and the user agent.</p>
+<h2 id="fop-factory">Customizing the FopFactory</h2>
+<p>The FopFactory holds configuration data and references to objects which are reusable over multiple rendering runs. It's important to instantiate it only once (except in special environments) and reuse it every time to create new FOUserAgent and Fop instances.</p>
+<p>You can set all sorts of things on the FopFactory:</p>
+<ul>
+<li>
+<p>The <strong>font base URL</strong> to use when resolving relative URLs for fonts. Example:
+fopFactory.getFontManager().setFontBaseURL("file:///C:/Temp/fonts");</p>
+</li>
+<li>
+<p>The <strong>hyphenation base URL</strong> to use when resolving relative URLs for hyphenation patterns. Example:
+fopFactory.setHyphenBaseURL("file:///C:/Temp/hyph");</p>
+</li>
+<li>
+<p>Disable <strong>strict validation</strong> . When disabled FOP is less strict about the rules established by the XSL-FO specification. Example:
+fopFactory.setStrictValidation(false);</p>
+</li>
+<li>
+<p>Enable an <strong>alternative set of rules for text indents</strong> that tries to mimic the behaviour of many commercial FO implementations, that chose to break the specification in this respect. The default of this option is 'false', which causes Apache FOP to behave exactly as described in the specification. To enable the alternative behaviour, call:
+fopFactory.setBreakIndentInheritanceOnReferenceAreaBoundary(true);</p>
+</li>
+<li>
+<p>Set the <strong>source resolution</strong> for the document. This is used internally to determine the pixel size for SVG images and bitmap images without resolution information. Default: 72 dpi. Example:
+fopFactory.setSourceResolution(96); // =96dpi (dots/pixels per Inch)</p>
+</li>
+<li>
+<p>Manually add an <strong>ElementMapping instance</strong> . If you want to supply a special FOP extension you can give the instance to the FOUserAgent. Normally, the FOP extensions can be automatically detected (see the documentation on extension for more info). Example:
+fopFactory.addElementMapping(myElementMapping); // myElementMapping is a org.apache.fop.fo.ElementMapping</p>
+</li>
+<li>
+<p>Set a <strong>URIResolver</strong> for custom URI resolution. By supplying a JAXP URIResolver you can add custom URI resolution functionality to FOP. For example, you can use <a href="http://xml.apache.org/commons/components/resolver/">Apache XML Commons Resolver</a> to make use of XCatalogs. Example:
+fopFactory.setURIResolver(myResolver); // myResolver is a javax.xml.transform.URIResolverBoth the FopFactory and the FOUserAgent have a method to set a URIResolver. The URIResolver on the FopFactory is primarily used to resolve URIs on factory-level (hyphenation patterns, for example) and it is always used if no other URIResolver (for example on the FOUserAgent) resolved the URI first.</p>
+</li>
+</ul>
+<h2 id="user-agent">Customizing the User Agent</h2>
+<p>The user agent is the entity that allows you to interact with a single rendering run, i.e. the processing of a single document. If you wish to customize the user agent's behaviour, the first step is to create your own instance of FOUserAgent using the appropriate factory method on FopFactory and pass that to the factory method that will create a new Fop instance:</p>
+<p>FopFactory fopFactory = FopFactory.newInstance(); // Reuse the FopFactory if possible!
+  // do the following for each new rendering run
+  FOUserAgent userAgent = fopFactory.newFOUserAgent();
+  // customize userAgent
+  Fop fop = fopFactory.newFop(MimeConstants.MIME_POSTSCRIPT, userAgent, out);
+You can do all sorts of things on the user agent:</p>
+<ul>
+<li>
+<p>The <strong>base URL</strong> to use when resolving relative URLs. Example:
+userAgent.setBaseURL("file:///C:/Temp/");</p>
+</li>
+<li>
+<p>Set the <strong>producer</strong> of the document. This is metadata information that can be used for certain output formats such as PDF. The default producer is "Apache FOP". Example:
+userAgent.setProducer("MyKillerApplication");</p>
+</li>
+<li>
+<p>Set the <strong>creating user</strong> of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+userAgent.setCreator("John Doe");</p>
+</li>
+<li>
+<p>Set the <strong>author</strong> of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+userAgent.setAuthor("John Doe");</p>
+</li>
+<li>
+<p>Override the <strong>creation date and time</strong> of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+userAgent.setCreationDate(new Date());</p>
+</li>
+<li>
+<p>Set the <strong>title</strong> of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+userAgent.setTitle("Invoice No 138716847");</p>
+</li>
+<li>
+<p>Set the <strong>keywords</strong> of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+userAgent.setKeywords("XML XSL-FO");</p>
+</li>
+<li>
+<p>Set the <strong>target resolution</strong> for the document. This is used to specify the output resolution for bitmap images generated by bitmap renderers (such as the TIFF renderer) and by bitmaps generated by Apache Batik for filter effects and such. Default: 72 dpi. Example:
+userAgent.setTargetResolution(300); // =300dpi (dots/pixels per Inch)</p>
+</li>
+<li>
+<p>Set <strong>your own Document Handler</strong> . This feature can be used for several purposes, the most likey usage of which would probably be binding a MIME type when the output is Intermediate Format (see <a href="#documenthandlers">Document Handlers</a> ). This also allows advanced users to create their own implementation of the document handler.
+userAgent.setDocumentHandlerOverride(documentHandler) // documentHandler is an instance of org.apache.fop.render.intermediate.IFDocumentHandler</p>
+</li>
+<li>
+<p>Set <strong>your own FOEventHandler instance</strong> . If you want to supply your own FOEventHandler or configure an FOEventHandler subclass in a special way you can give the instance to the FOUserAgent. Normally, the FOEventHandler instance is created by FOP. Example:
+userAgent.setFOEventHandlerOverride(myFOEventHandler); // myFOEventHandler is an org.apache.fop.fo.FOEventHandler</p>
+</li>
+<li>
+<p>Set a <strong>URIResolver</strong> for custom URI resolution. By supplying a JAXP URIResolver you can add custom URI resolution functionality to FOP. For example, you can use <a href="http://xml.apache.org/commons/components/resolver/">Apache XML Commons Resolver</a> to make use of XCatalogs. Example:
+userAgent.setURIResolver(myResolver); // myResolver is a javax.xml.transform.URIResolverBoth the FopFactory and the FOUserAgent have a method to set a URIResolver. The URIResolver on the FOUserAgent is used for resolving URIs which are document-related. If it's not set or cannot resolve a URI, the URIResolver from the FopFactory is used.
+You should not reuse an FOUserAgent instance between FOP rendering runs although you can. Especially in multi-threaded environment, this is a bad idea.</p>
+</li>
+</ul>
+<h1 id="config-external">Using a Configuration File</h1>
+<p>Instead of setting the parameters manually in code as shown above you can also set many values from an XML configuration file:</p>
+<p>import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;</p>
+<p>/<em>..</em>/</p>
+<p>DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
+Configuration cfg = cfgBuilder.buildFromFile(new File("C:/Temp/mycfg.xml"));
+fopFactory.setUserConfig(cfg);</p>
+<p>/<em> ..or.. </em>/</p>
+<p>fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));
+The layout of the configuration file is described on the <a href="configuration.html">Configuration page</a> .</p>
+<h1 id="documenthandlers">Document Handlers</h1>
+<p>The document handlers are classes that inherit from <code>org.apache.fop.render.intermediate.IFDocumentHandler</code> . This is an interface for which a MIME type specific implementation can be created. This same handler is used either when XSL-FO is used as the input or when Intermediate Format is used. Since IF is output format agnostic, if custom fonts or other configuration information that affect layout (specific to a particular MIME type) are given then FOP needs that contextual information. The document handler provides that context so that when the IF is rendered, it is more visually consistent with FO rendering. The code below shows an example of how a document handler can be used to provide PDF configuration data to the IFSerializer.
+IFDocumentHandler targetHandler = userAgent.getRendererFactory().createDocumentHandler(userAgent, MimeConstants.MIME_PDF);</p>
+<p>IFSerializer ifSerializer = new IFSerializer();  //Create the IFSerializer to write the intermediate format
+ifSerializer.setContext(new IFContext(userAgent));
+ifSerializer.mimicDocumentHandler(targetHandler);   //Tell the IFSerializer to mimic the target format</p>
+<p>userAgent.setDocumentHandlerOverride(ifSerializer);  //Make sure the prepared document handler is used
+      The rest of the code is the same as in <a href="#basics">Basic Usage Patterns</a> .</p>
+<h1 id="hints">Hints</h1>
+<h2 id="object-reuse">Object reuse</h2>
+<p>Fop instances shouldn't (and can't) be reused. Please recreate Fop and FOUserAgent instances for each rendering run using the FopFactory. This is a cheap operation as all reusable information is held in the FopFactory. That's why it's so important to reuse the FopFactory instance.</p>
+<h2 id="awt">AWT issues</h2>
+<p>If your XSL-FO files contain SVG then Apache Batik will be used. When Batik is initialised it uses certain classes in <code>java.awt</code> that intialise the Java AWT classes. This means that a daemon thread is created by the JVM and on Unix it will need to connect to a DISPLAY.</p>
+<p>The thread means that the Java application may not automatically quit when finished, you will need to call <code>System.exit()</code> . These issues should be fixed in the JDK 1.4.</p>
+<p>If you run into trouble running FOP on a head-less server, please see the <a href="graphics.html#batik">notes on Batik</a> .</p>
+<h2 id="render-info">Getting information on the rendering process</h2>
+<p>To get the number of pages that were rendered by FOP you can call <code>Fop.getResults()</code> . This returns a <code>FormattingResults</code> object where you can look up the number of pages produced. It also gives you the page-sequences that were produced along with their id attribute and their numbers of pages. This is particularly useful if you render multiple documents (each enclosed by a page-sequence) and have to know the number of pages of each document.</p>
+<h1 id="performance">Improving performance</h1>
+<p>There are several options to consider:</p>
+<ul>
+<li>
+<p>Whenever possible, try to use SAX to couple the individual components involved (parser, XSL transformer, SQL datasource etc.).</p>
+</li>
+<li>
+<p>Depending on the target OutputStream (in case of a FileOutputStream, but not for a ByteArrayOutputStream, for example) it may improve performance considerably if you buffer the OutputStream using a BufferedOutputStream: <code>out = new java.io.BufferedOutputStream(out);</code> <br></br>Make sure you properly close the OutputStream when FOP is finished.</p>
+</li>
+<li>
+<p>Cache the stylesheet. If you use the same stylesheet multiple times you can set up a JAXP <code>Templates</code> object and reuse it each time you do the XSL transformation. (More information can be found <a href="http://www.javaworld.com/javaworld/jw-05-2003/jw-0502-xsl.html">here</a> .)</p>
+</li>
+<li>
+<p>Use an XSLT compiler like <a href="http://xml.apache.org/xalan-j/xsltc_usage.html">XSLTC</a> that comes with Xalan-J.</p>
+</li>
+<li>
+<p>Fine-tune your stylesheet to make the XSLT process more efficient and to create XSL-FO that can be processed by FOP more efficiently. Less is more: Try to make use of property inheritance where possible.</p>
+</li>
+<li>
+<p>You may also wish to consider trying to reduce <a href="http://xmlgraphics.apache.org/fop/trunk/running.html#memory">memory usage</a> .</p>
+</li>
+</ul>
+<h1 id="multithreading">Multithreading FOP</h1>
+<p>Apache FOP may currently not be completely thread safe. The code has not been fully tested for multi-threading issues, yet. If you encounter any suspicious behaviour, please notify us.</p>
+<p>There is also a known issue with fonts being jumbled between threads when using the Java2D/AWT renderer (which is used by the -awt and -print output options). In general, you cannot safely run multiple threads through the AWT renderer.</p>
+<h1 id="examples">Examples</h1>
+<p>The directory "{fop-dir}/examples/embedding" contains several working examples.</p>
+<h2 id="ExampleFO2PDF">ExampleFO2PDF.java</h2>
+<p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleFO2PDF.java?view=markup">example</a> demonstrates the basic usage pattern to transform an XSL-FO file to PDF using FOP.
+<figure alt="Example XSL-FO to PDF" src="images/EmbeddingExampleFO2PDF.png"></figure></p>
+<h2 id="ExampleXML2FO">ExampleXML2FO.java</h2>
+<p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2FO.java?view=markup">example</a> has nothing to do with FOP. It is there to show you how an XML file can be converted to XSL-FO using XSLT. The JAXP API is used to do the transformation. Make sure you've got a JAXP-compliant XSLT processor in your classpath (ex. <a href="http://xml.apache.org/xalan-j">Xalan</a> ).
+<figure alt="Example XML to XSL-FO" src="images/EmbeddingExampleXML2FO.png"></figure></p>
+<h2 id="ExampleXML2PDF">ExampleXML2PDF.java</h2>
+<p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2PDF.java?view=markup">example</a> demonstrates how you can convert an arbitrary XML file to PDF using XSLT and XSL-FO/FOP. It is a combination of the first two examples above. The example uses JAXP to transform the XML file to XSL-FO and FOP to transform the XSL-FO to PDF.
+<figure alt="Example XML to PDF (via XSL-FO)" src="images/EmbeddingExampleXML2PDF.png"></figure>
+The output (XSL-FO) from the XSL transformation is piped through to FOP using SAX events. This is the most efficient way to do this because the intermediate result doesn't have to be saved somewhere. Often, novice users save the intermediate result in a file, a byte array or a DOM tree. We strongly discourage you to do this if it isn't absolutely necessary. The performance is significantly higher with SAX.</p>
+<h2 id="ExampleObj2XML">ExampleObj2XML.java</h2>
+<p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2XML.java?view=markup">example</a> is a preparatory example for the next one. It's an example that shows how an arbitrary Java object can be converted to XML. It's an often needed task to do this. Often people create a DOM tree from a Java object and use that. This is pretty straightforward. The example here, however, shows how to do this using SAX, which will probably be faster and not even more complicated once you know how this works.
+<figure alt="Example Java object to XML" src="images/EmbeddingExampleObj2XML.png"></figure>
+For this example we've created two classes: ProjectTeam and ProjectMember (found in xml-fop/examples/embedding/java/embedding/model). They represent the same data structure found in xml-fop/examples/embedding/xml/xml/projectteam.xml. We want to serialize to XML a project team with several members which exist as Java objects. Therefore we created the two classes: ProjectTeamInputSource and ProjectTeamXMLReader (in the same place as ProjectTeam above).</p>
+<p>The XMLReader implementation (regard it as a special kind of XML parser) is responsible for creating SAX events from the Java object. The InputSource class is only used to hold the ProjectTeam object to be used.</p>
+<p>Have a look at the source of ExampleObj2XML.java to find out how this is used. For more detailed information see other resources on JAXP (ex. <a href="http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/3_generate.html">An older JAXP tutorial</a> ).</p>
+<h2 id="ExampleObj2PDF">ExampleObj2PDF.java</h2>
+<p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup">example</a> combines the previous and the third to demonstrate how you can transform a Java object to a PDF directly in one smooth run by generating SAX events from the Java object that get fed to an XSL transformation. The result of the transformation is then converted to PDF using FOP as before.
+<figure alt="Example Java object to PDF (via XML and XSL-FO)" src="images/EmbeddingExampleObj2PDF.png"></figure></p>
+<h2 id="ExampleDOM2PDF">ExampleDOM2PDF.java</h2>
+<p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleDOM2PDF.java?view=markup">example</a> has FOP use a DOMSource instead of a StreamSource in order to use a DOM tree as input for an XSL transformation.</p>
+<h2 id="ExampleSVG2PDF">ExampleSVG2PDF.java (PDF Transcoder example)</h2>
+<p>This <a href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleSVG2PDF.java?view=markup">example</a> shows the usage of the PDF Transcoder, a sub-application within FOP. It is used to generate a PDF document from an SVG file.</p>
+<h2 id="ExampleConcat">ExampleConcat.java (IF Concatenation example)</h2>
+<p>This can be found in the <code>embedding.intermediate</code> package within the examples and describes how IF can be concatenated to produce a document. Because IF has been through FOPs layout engine, it should be visually consistent with FO rendered documents while allowing the user to merge numerous documents together.</p>
+<h2 id="example-notes">Final notes</h2>
+<p>These examples should give you an idea of what's possible. It should be easy to adjust these examples to your needs. Also, if you have other examples that you think should be added here, please let us know via either the fop-users or fop-dev mailing lists. Finally, for more help please send your questions to the fop-users mailing list.</p></div></div>
+      <div class="clear"></div>
+
+	  <div id="footer">
+		<a alt="Apache Software Foundation" href="http://www.apache.org">
+		  <img id="asf-logo" alt="Apache Software Foundation" src="/images/feather-small.gif"/ width="100">
+		</a>
+		<div class="copyright">
+		  <p>
+			Copyright &copy; 2011 The Apache Software Foundation, Licensed under
+			the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
+			<br />
+			Apache, Apache XML Graphics, the Apache feather logo, and the Apache XML Graphics logos are
+			trademarks of <a href="http://www.apache.org">The Apache Software Foundation</a>. All other
+			marks mentioned may be trademarks or registered trademarks of their respective owners.
+			<br />
+		  </p>
+		</div> 
+	  </div>
+  </body>
+</html>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org