> [2] I've added a "configuration" parameter in
> XXE_install_dir/addon/config/docbook/xslMenu.incl:

Isn't it safer to alter just "~/.fop/addon/customize.xxe" modifying  
XXE private files is nasty idea, especially because those get  
overwritten by each upgrade:
---
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";  
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns="http://www.xmlmind.com/xmleditor/schema/configuration 
">

        <property name="docb.toPS.transform" url="true">db-pdf.xsl</property>

        <parameterGroup name="docb.toPS.FOPParameters">
                <parameter name="configuration">%C%Sfop-config.xml</parameter>
        </parameterGroup>

        <property name="db5.toPS.transform" url="true">db5-pdf.xsl</property>

        <parameterGroup name="db5.toPS.FOPParameters">
                <parameter name="configuration">%C%Sfop-config.xml</parameter>
        </parameterGroup>

</configuration>
---

Note also the db-pdf.xsl parameter, where you can specify your  
favorite fonts and style for your output, here's mine:
(You need to have this if you want to have non ANSI character glyphs,  
by default PDFs are using with built-in ANSI only fonts)
---
<?xml version="1.0"?>
<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.master" select="11"/>
        <xsl:param name="body.font.family" select="'&quot;Palatino  
Linotype&quot;'"/>
        <xsl:param name="title.font.family" select="'&quot;Palatino  
Linotype&quot;'"/>
        <xsl:param name="dingbat.font.family" select="'&quot;Palatino  
Linotype&quot;'"/>
        <xsl:param name="sans.font.family" select="'&quot;Palatino  
Linotype&quot;'"/>
        <xsl:param name="monospace.font.family" select="'&quot;Courier  
New&quot;'"/>
        <xsl:param name="shade.verbatim" select="1"/>
        <xsl:param name="fop1.extensions" select="1"/>
        <xsl:param name="draft.watermark.image" select="''"/>
</xsl:stylesheet>
---

> I followed the instructions found here:
> http://xmlgraphics.apache.org/fop/0.95/fonts.html
>
> [1] I've created fop.xconf in ~/.fop/:
> ---
> <?xml version="1.0"?>
> <fop version="1.0">
>  <renderers>
>    <renderer mime="application/pdf">
>      <fonts>
>
> <directory>/home/hussein/src/4xxe_addon/mathml_config/fonts</ 
> directory>
>
>        <auto-detect/>
>      </fonts>
>    </renderer>
>  </renderers>
> </fop>
> ---

This one <auto-detect/> is pretty cool, and finally it works with  
4.1.0 and latest FOP 0.95! All your system fonts shall be now visible  
for FOP.

Finally if anyone's interested I got alternative customize.xxe that  
converts current document into PDF and opens it in the default viewer:
(I removed IMHO unnecessary step to copy all dependent files into tmp,  
while they are already there on disk including callout graphics)
---
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";  
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns="http://www.xmlmind.com/xmleditor/schema/configuration 
">
        <command name="fopPS">
                <process>
                        <copyDocument to="__doc.xml" />
                        <transform stylesheet="%1-%0.xsl"
                                file="__doc.xml" to="__doc.fo"
                                label="Convert to PDF, PostScript"
                                
documentation="http://docbook.sourceforge.net/release/xsl/current/doc/fo/ 
%{parameter.name|paper.type}.html">
                                <parameter name="use.extensions">1</parameter>
                                <parameter 
name="graphicsize.extension">0</parameter>
                                <parameter name="paper.type">A4</parameter>
                                <parameter name="generate.toc">%2</parameter>
                                <parameter 
name="toc.section.depth">3</parameter>
                                <parameter 
name="section.autolabel">1</parameter>
                                <parameter name="callout.graphics">1</parameter>
                                <parameter name="shade.verbatim">1</parameter>
                                <parameter name="ulink.show">0</parameter>
                        </transform>
                        <processFO processor="FOP" file="__doc.fo" 
to="__doc.%0">
                                <parameter 
name="configuration">%C%Sfop-config.xml</parameter>
                                <parameter name="renderer">%0</parameter>
                                <parameter 
name="strict-validation">false</parameter>
                        </processFO>
                        <copy files="__doc.%0" to="%P%S%R.%0" />
                </process>
        </command>
        <command name="openPS">
                <macro>
                        <sequence>
                                <command name="fopPS" parameter='"%0" "%1" 
"%2"' />
                                <command name="start" 
parameter="helper(defaultViewer) '%P%S%R. 
%0'" />
                        </sequence>
                </macro>
        </command>
        <binding>
                <keyPressed code="P" modifiers="mod alt" />
                <command name="openPS" parameter='pdf db "/book toc /article 
toc"'/>
        </binding>
        <binding>
                <keyPressed code="P" modifiers="mod alt shift" />
                <command name="openPS" parameter='pdf db'/>
        </binding>
</configuration>
---

This also adds pretty cool Ctrl(Cmd on Mac)+Alt+P shortcut to convert  
and open your document in PDF.

Cheers,
-- 
Adam Strzelecki


Reply via email to