[daisy] PDF export i18n tip: how to export UTF8-encoded docs
to PDF in different languages, eg. Russian without ###
Bruno Dumon
bruno at outerthought.org
Mon May 7 05:32:04 CDT 2007
Hi,
Could you supply a patch for the XSL's? (see also
http://cocoondev.org/daisydocs-2_0/293-cd.html )
I think the usage of font-families could also be cleaned up. I'm not
sure if there's any reason to use specific fonts names, it could be that
this was just copied from samples. I've not found any uses of tahoma or
verdana in the XSL-FO's though.
The information on how to configure FOP would make an excellent article
for the wiki or knowledgebase, if you'd like write access just register
on the daisy instance and let me know your login.
BTW, for the PDF book publishing we use another XSL-FO engine (ibex),
which hence also needs other configuration. In the future I'd like to
see this moving to FOP 0.9x though -- if anyone would be able to play
around with that and report on how it's working, that would be great.
On Sun, 2007-05-06 at 17:19 +0300, Vitaly Sazanovich wrote:
> Hello,
> as you might know from my prev. message (to Jira, but also auto-copied
> to the mail list) I was trying to see Russian letters in the exported
> PDF but to no avail.
> What is said here:
> http://cocoon.apache.org/2.1/userdocs/pdf-serializer.html is all
> correct. What is not obvious from that is why it still doesn't work
> after all steps implemented.
> In the example used at this link Arial is used. While if we do 'font'
> search throughout the Daisy sources we will find the following font aliases:
> helvetica,sans-serif,tahoma,verdana,monospace,Tahoma,Verdana
> It means that they all should be mentioned in the fop-config file! Plus
> their variations in weight and style.
> Here is my fop-config.xml that I came up with finally. It's not quite
> correct since it uses only Arial (regular,italic,bold, italic-bold) for
> all fonts but I don't mind as long as it is not ###
>
> But this solves the problem only partially. It turns out that what you
> see in html in tags pre, p and others is displayed correctly in PDF. But
> tags h1,h2,hX are still ### in PDF for Russian.
> To fix this find file:
> ..\webapp\daisy\resources\skins\default\xslt\xslfo-styles.xsl and add
> <xsl:attribute name="font-family"><xsl:value-of
> select="$fontSansSerif"/></xsl:attribute>
> to
> <xsl:attribute-set name="h1" use-attribute-sets="base.heading.style">
> and other attribute declarations of h's.
>
> I hope this will save you some time (took me around 2 days) when you
> encounter such problems.
> Also note that font aliases are case-sensitive. So we actually have to
> mention both Verdana and verdana, I guess.
> --VS
>
> PS Another problem that you might encounter when trying to generate font
> metric file is the infamous NoClassDefFoundError
> (http://www.google.com/search?hl=en&rlz=1B2RNFA_enIN210IN210&q=org.apache.fop.fonts.apps.TTFReader+noclassdeffounderror&btnG=Search)
> I solved this after around 100 attempts by adding/removing jars to the
> classpath.
> Here is how my successful java call looked like:
> C:\jdk6\bin\java -classpath
> "D:\dist\fonts\fop.jar;D:\dist\fonts\commons-io-1.1.jar;D:\dist\fonts\fop.jar;D:\dist\fonts\commons-logging-1.0.4.jar;D:\dist\fonts\fop.jar;D:\dist\fonts\xercesImpl-2.9.0.jar;D:\dist\fonts\xml-apis-1.3.04.jar;D:\dist\fonts\avalon-framework-impl-4.3.jar;D:\dist\fonts\xalan-2.7.0.jar"
> org.apache.fop.fonts.apps.TTFReader courbi.ttf courbi.ttf.xml
> fop.jar is from the latest fop dist package (It contains TTFReader.main
> function unlike some earlier versions).
> PS2 Here is the result of my endeavors: http://psy.ediew.com/psy/2-DSY.html
>
>
> __________________________________________________________________________
> <configuration>
> <fonts>
> <font metrics-file="file:///home/adsapient/dist/fonts/arial.ttf.xml"
> kerning="yes" embed-file="/home/adsapient/dist/fonts/arial.ttf">
> <font-triplet name="Arial" style="normal" weight="normal"/>
> <font-triplet name="ArialMT" style="normal" weight="normal"/>
>
> <font-triplet name="sans-serif" style="normal" weight="normal"/>
> <font-triplet name="serif" style="normal" weight="normal"/>
> <font-triplet name="helvetica" style="normal" weight="normal"/>
>
> <font-triplet name="Tahoma" style="normal" weight="normal"/>
> <font-triplet name="Verdana" style="normal" weight="normal"/>
> <font-triplet name="Helvetica" style="normal" weight="normal"/>
>
> <font-triplet name="tahoma" style="normal" weight="normal"/>
> <font-triplet name="verdana" style="normal" weight="normal"/>
> <font-triplet name="monospace" style="normal" weight="normal"/>
>
> <font-triplet name="Courier" style="normal" weight="normal"/>
> <font-triplet name="Courier New" style="normal" weight="normal"/>
>
> </font>
>
> <font metrics-file="file:///home/adsapient/dist/fonts/arialbd.ttf.xml"
> kerning="yes" embed-file="/home/adsapient/dist/fonts/arialbd.ttf">
> <font-triplet name="Arial" style="normal" weight="bold"/>
> <font-triplet name="ArialMT" style="normal" weight="bold"/>
>
> <font-triplet name="sans-serif" style="normal" weight="bold"/>
> <font-triplet name="serif" style="normal" weight="bold"/>
> <font-triplet name="helvetica" style="normal" weight="bold"/>
>
> <font-triplet name="Tahoma" style="normal" weight="bold"/>
> <font-triplet name="Verdana" style="normal" weight="bold"/>
> <font-triplet name="Helvetica" style="normal" weight="bold"/>
>
>
> <font-triplet name="tahoma" style="normal" weight="bold"/>
> <font-triplet name="verdana" style="normal" weight="bold"/>
> <font-triplet name="monospace" style="normal" weight="bold"/>
>
> <font-triplet name="Courier" style="normal" weight="bold"/>
> <font-triplet name="Courier New" style="normal" weight="bold"/>
>
> </font>
> <font metrics-file="file:///home/adsapient/dist/fonts/ariali.ttf.xml"
> kerning="yes" embed-file="/home/adsapient/dist/fonts/ariali.ttf">
> <font-triplet name="Arial" style="italic" weight="normal"/>
> <font-triplet name="ArialMT" style="italic" weight="normal"/>
>
> <font-triplet name="sans-serif" style="italic" weight="normal"/>
> <font-triplet name="serif" style="italic" weight="normal"/>
> <font-triplet name="helvetica" style="italic" weight="normal"/>
>
> <font-triplet name="Tahoma" style="italic" weight="normal"/>
> <font-triplet name="Verdana" style="italic" weight="normal"/>
> <font-triplet name="Helvetica" style="italic" weight="normal"/>
>
>
> <font-triplet name="tahoma" style="italic" weight="normal"/>
> <font-triplet name="verdana" style="italic" weight="normal"/>
> <font-triplet name="monospace" style="italic" weight="normal"/>
>
> <font-triplet name="Courier" style="italic" weight="normal"/>
> <font-triplet name="Courier New" style="italic" weight="normal"/>
>
> </font>
>
> <font metrics-file="file:///home/adsapient/dist/fonts/arialbi.ttf.xml"
> kerning="yes" embed-file="/home/adsapient/dist/fonts/arialbi.ttf">
> <font-triplet name="Arial" style="italic" weight="bold"/>
> <font-triplet name="ArialMT" style="italic" weight="bold"/>
>
> <font-triplet name="sans-serif" style="italic" weight="bold"/>
> <font-triplet name="serif" style="italic" weight="bold"/>
> <font-triplet name="helvetica" style="italic" weight="bold"/>
>
> <font-triplet name="Tahoma" style="italic" weight="bold"/>
> <font-triplet name="Verdana" style="italic" weight="bold"/>
> <font-triplet name="Helvetica" style="italic" weight="bold"/>
>
> <font-triplet name="tahoma" style="italic" weight="bold"/>
> <font-triplet name="verdana" style="italic" weight="bold"/>
> <font-triplet name="monospace" style="italic" weight="bold"/>
>
> <font-triplet name="Courier" style="italic" weight="bold"/>
> <font-triplet name="Courier New" style="italic" weight="bold"/>
>
> </font>
>
> </fonts>
> </configuration>
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno at outerthought.org bruno at apache.org
More information about the daisy
mailing list