forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Børre Gaup <boe...@skolelinux.no>
Subject Re: greek characters work for pdf
Date Tue, 10 Oct 2006 13:59:27 GMT
Bear, golggotmánu 6. b. 2006 20.11, Evangelos Vlachogiannis čálii:
> also pdf table of contents is fine!! but still text appears "######"
>

I had the same problem for the sami characters šŧŋđžč.

I got this working by embedding characters into the pdfs. 

I began by reading http://cocoon.apache.org/2.1/userdocs/pdf-serializer.html. 

These are the steps I took to make it work (works on Linux and Mac OS X):

1. Make a directory <yourproject>/src/documentation/resources/fonts
2. Download DejaVu truetype fonts. 
http://dejavu.sourceforge.net/wiki/index.php/Download
2. Unpack the fonts in to the above mentioned fonts directory
3. Create font metrics files. This is done on the command line.
cd <yourproject>/src/documentation/resources/fonts
for i in *.ttf do;
java -cp "$FORREST_HOME/lib/core/fop-0.20.5.jar;
$FORREST_HOME/lib/endorsed/xercesImpl-2.8.0.jar;
$FORREST_HOME/lib/endorsed/xml-apis-1.3.03.jar" 
org.apache.fop.fonts.apps.TTFReader $i $i.xml;done

There are 21 different font files in the dejavu archive, so the previous line 
will go through them one by one, and make font metrics files for each and 
everyone of them. The alternative is to write:

java -cp "$FORREST_HOME/lib/core/fop-0.20.5.jar;
$FORREST_HOME/lib/endorsed/xercesImpl-2.8.0.jar;
$FORREST_HOME/lib/endorsed/xml-apis-1.3.03.jar" 
org.apache.fop.fonts.apps.TTFReader <fontfile> <fontfile>.xml

for each and everyone of the font files ...

4. Create a custom font configuration file. I attach the one I use. 
Notice that it has absolute paths, so you will have to change them to fit to 
your directory structure. ( I tried to make this work without absolute paths, 
but to no avail).

5. Configure the fo2pdf serializer
Open the file 
$FORREST_HOME/plugins/org.apache.forrest.plugin.output.pdf/output.xmap

Change the stanza:
<map:serializer name="fo2pdf"
                src="org.apache.cocoon.serialization.FOPSerializer"
                mime-type="application/pdf"/>

To:
<map:serializer name="fo2pdf"
                src="org.apache.cocoon.serialization.FOPSerializer"
                mime-type="application/pdf">
  
<user-config><path-to-your-project>/src/documentation/resources/fonts/config.xml</user-config>
</map:serializer>

After that:
cd $FORREST_HOME/plugins/org.apache.forrest.plugin.output.pdf
ant local-deploy

Then your changes ought to emerge in 
$FORREST/build/plugins/org.apache.forrest.plugin.output.pdf/output.xmap


6. Make forrest use these changes:
a. Copy the directory $FORREST_HOME/main/webapp/skins/common to 
<yourproject>/src/documentation/skins. That means inside the directory 
<yourprojectr>/src/documentations/skins you should have a directory called 
common when you are finished copying ... ;)

b. Edit the files in common/xslt/fo/
I attach mine, change to suit your taste.

There sure has snuck some errors into this explanation, there are plenty of 
stepping stones. So please give feedback if this was of any use.


-- 
Børre Gaup, Tromsø

Mime
View raw message