Hi,

Here's my complete recipe for customization of DocBook style-sheets,  
together with FOP customization and enabling automatic system fonts.

RECIPE
------

1) In order to TTF font-cache generation work with FOP1 addon, you  
need to download latest fop-0.9x nightly build and replace all *.jar  
files except fop1_foprocessor.jar in addon/fop1_foprocessor with the  
ones found in the nightly, especially don't forget about Xalan.jar  
which is missing in FOP1 addon, but it is required for FOP to generate  
properly font-cache.

2) Create following files in .xxe (or %USERPROFILE%\Application Data 
\XMLmind\XMLEditor in Windows)

.xxe/addon/customize.xxe

> <?xml version="1.0" encoding="UTF-8"?>
> <cfg:configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
> " xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> xmlns:cfg="http://www.xmlmind.com/xmleditor/schema/configuration 
> ">
>       <cfg:property name="docb.toPS.transform" url="true">docbook- 
> pdf.xsl</cfg:property>
>       <cfg:parameterGroup name="docb.toPS.FOPParameters">
>               <!-- Enable me in Windows <cfg:parameter 
> name="configuration">%H 
> \Application Data\XMLmind\XMLEditor\addon\fop-config.xml</ 
> cfg:parameter> -->
>               <cfg:parameter 
> name="configuration">%H/.xxe/addon/fop-config.xml</ 
> cfg:parameter>
>       </cfg:parameterGroup>
> </cfg:configuration>

.xxe/addon/docbook-pdf.xsl

> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";  
> version='1.0'>
>       <xsl:import href="xxe-config:docbook/xsl/fo/docbook.xsl"/>
>       <xsl:param name="admon.graphics.path" select="'xxe-config:docbook/ 
> xsl/images/'"/>
>       <xsl:param name="callout.graphics.path" select="'xxe-config:docbook/ 
> images/callouts/'"/>
>       <xsl:param name="body.font.family" select="'TimesNewRoman'"/>
>       <xsl:param name="title.font.family" select="'TimesNewRoman'"/>
>       <xsl:param name="dingbat.font.family" select="'TimesNewRoman'"/>
>       <xsl:param name="sans.font.family" select="'TimesNewRoman'"/>
>       <xsl:param name="monospace.font.family" select="'CourierNew'"/>
>       <xsl:param name="shade.verbatim" select="1"/>
>       <xsl:param name="fop1.extensions" select="1"/>
>       <xsl:param name="draft.watermark.image" select="''"/>
>       <xsl:param name="header.column.widths">1 8 1</xsl:param>
>       <xsl:param name="footer.column.widths">1 6 1</xsl:param>
>       <xsl:param name="admon.graphics" select="1"/>
>       <xsl:param name="admon.textlabel" select="0"/>
>       <xsl:param name="admon.graphics.extension" select="'.svg'"/>
> </xsl:stylesheet>


.xxe/addon/fop-config.xml

> <?xml version="1.0"?>
> <fop version="1.0">
>       <base>.</base>
>       <default-page-settings height="11in" width="8.26in"/>
>       <renderers>
>               <renderer mime="application/pdf">
>                       <filterList>
>                               <value>flate</value>
>                       </filterList>
>                       <fonts>
>                               <auto-detect/>
>                       </fonts>
>                       <xmlHandler mime="text/svg+xml">
>                       </xmlHandler>
>               </renderer>
>               <renderer mime="application/postscript">
>                       <xmlHandler mime="image/svg+xml">
>                       </xmlHandler>
>               </renderer>
>               <renderer mime="application/vnd.hp-PCL">
>               </renderer>
>               <renderer mime="image/svg+xml">
>                       <format type="paginated"/>
>                       <link value="true"/>
>                       <strokeText value="false"/>
>               </renderer>
>               <renderer mime="application/awt">
>               </renderer>
>               <renderer mime="text/xml">
>               </renderer>
>               <renderer mime="text/plain">
>                       <pageSize columns="80"/>
>               </renderer>
>       </renderers>
> </fop>

3) Adjust fonts in docbook-pdf.xsl so they're matching your need and  
existing ones, adjust customize.xxe so it is matching you XXE user  
profile.

After 1st run FOP should create .fop/fop-font.cache in your home folder.

CONCLUSIONS
-----------

1) XXE shouldn't copy any callouts or admon graphics, but instead  
automatically set "admon.graphics.path" to "'xxe-config:docbook/xsl/ 
images/'" and "callout.graphics.path" to "'xxe-config:docbook/images/ 
callouts/'". (Here I do it manually & this saves space & time)

2) XXE shouldn't copy also any document related graphics, but rather  
set current working directory to place where document resides, so all  
paths for FOP should be OK. (This saves space & time)
Only temporary file should be actually .fo tile (or additionally in  
case or ftp://, http:// output a PDF file).

3) Files & paths specified in .xxe/addon/customize.xxe should be  
relative to .xxe/addon/customize.xxe but they're not in all cases,  
<cfg:parameter name="configuration"> is relative to /Applications on  
my Mac and C:\Program Files\XXE\bin on Windows (I think this is a bug)

Regards,
-- 
Adam Strzelecki |: nanoant.com :|


Reply via email to