On 02/04/2010 01:32 PM, Valdis Vītoliņš wrote:
I learned how to add custom TTF font and metrics for
FOP.
Test project can be downloaded from
http://odo.lv/ftp/temp/FOP.zip
There are FOP jars and "Lucida Sans Unicode" TTF font with generated
metrics file.
Metrics can be created using generate_font_metrics.bat script. Test PDF
can be generated with test1.bat script.
Even the FOP developers say that generating font metrics is not needed,
and deprecated. FOP should correctly find and use system fonts, and
should correctly work with TTF fonts. The problem is that FOP doesn't
find the fonts provided by XWiki because Tomcat doesn't use an URI
scheme that FOP understands. You can extract
WEB-INF/lib/xwiki-core-XYZ.java#fop-config.xml into WEB-INF/classes and
adjust the <fonts> settings so that you manually specify the path to the
right font files. The syntax for the config xml should be on the FOP site.
Now questions are:
How can I invoke customized FOP with additional parameter for my config
file from Xwiki?
Or how can I change default font From "Times-Roman" to "Lucida Sans
Unicode"?
Extract xhtml2fo.xsl from WEB-INF/lib/xwiki-core-XYZ.jar into
WEB-INF/classes and search for the line:
<xsl:attribute name="font-family">FreeSerif,serif</xsl:attribute>
Replace FreeSerif with what you want.
Valdis
> On 02/01/2010 09:47 PM, Valdis Vītoliņš wrote:
>> I'm investigating issue
http://jira.xwiki.org/jira/browse/XWIKI-4724
>> Now I can generate right PDF using separate FOP with additional
>> configuration files and invocation parameters.
>> Though I don't know, how to invoke it in such way from Xwiki.
>>
>> Do you have any suggestions/ideas?
>
> I gave a workaround in a comment on that issue, in case somebody else is
> interested in this problem and wants an answer.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/