forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heather Phipps <hmphi...@gmail.com>
Subject Re: Japanese PDF rendering
Date Wed, 29 Apr 2009 11:58:14 GMT
I have an update and some further questions.

The Japanese font display issue is only occurring with my DocBook XML source
files.  These are not handled by document2fo.xsl, but rather by the DocBook
4.4 stylesheets, which I downloaded and included on my own.  Here is an
excerpt from my project sitemap showing how I did this:

   <map:match pattern="**.pdf">
    <map:act type="sourcetype" src="{properties:content.xdocs}{1}.xml">
     <map:select type="parameter">
      <map:parameter name="parameter-selector-test" value="{sourcetype}"/>
      <map:when test="docbook-v4.4">
       <map:generate src="{properties:content.xdocs}{../1}.xml"/>
       <map:transform
          src="{properties:resources.stylesheets}/docbook-xsl-1.74.3-pre
2/fo/docbook.xsl"/>
       <map:serialize type="fo2pdf"/>
      </map:when>
     </map:select>
    </map:act>
   </map:match>

I didn't feel like messing around in the the DocBook stylesheets just yet,
so I hacked the font config file to see if I could get other (non-Japanese)
fonts to display properly in my PDFs generated from DocBook.  Here is the
hacked font config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<fonts>
 <font
metrics-file="/Users/Heather/apache-forrest-0.8/main/webapp/resources/fonts/Brush_Script.xml"
embed-file="/Users/Heather/apache-forrest-0.8/main/webapp/resources/fonts/Brush_Script.ttf"
kerning="yes">
  <font-triplet name="serif" style="normal" weight="normal"/>
  <font-triplet name="serif" style="normal" weight="bold"/>
  <font-triplet name="serif" style="italic" weight="normal"/>
  <font-triplet name="serif" style="italic" weight="bold"/>
  <font-triplet name="sans-serif" style="normal" weight="normal"/>
  <font-triplet name="sans-serif" style="normal" weight="bold"/>
  <font-triplet name="sans-serif" style="italic" weight="normal"/>
  <font-triplet name="sans-serif" style="italic" weight="bold"/>
  <font-triplet name="sans" style="normal" weight="normal"/>
  <font-triplet name="sans" style="normal" weight="bold"/>
  <font-triplet name="sans" style="italic" weight="normal"/>
  <font-triplet name="sans" style="italic" weight="bold"/>
  <font-triplet name="monospace" style="normal" weight="normal"/>
  <font-triplet name="monospace" style="normal" weight="bold"/>
  <font-triplet name="monospace" style="italic" weight="normal"/>
  <font-triplet name="monospace" style="italic" weight="bold"/>
 </font>
</fonts>
</configuration>

This works...it causes the PDFs created from both sample XML files included
in the demo site and my DocBook XML files to use the "Brush Script" font.
However, when I attempt the same thing with a Japanese font, it works
properly for the sample XML files (even when I add some Japanese text) but
not for my DocBook XML files...I get the following out of memory error:

* [54/14]   [0/0]     9.776s 0b      samples/dotnet.pdf
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:95)
    at org.apache.fop.tools.IOUtil.copyStream(IOUtil.java:77)
    at org.apache.fop.tools.IOUtil.toByteArray(IOUtil.java:95)
    at org.apache.fop.fonts.FontFileReader.init(FontFileReader.java:76)
    at org.apache.fop.fonts.FontFileReader.<init>(FontFileReader.java:105)
    at
org.apache.fop.render.pdf.fonts.MultiByteFont.getFontFile(MultiByteFont.java:237)
    at
org.apache.fop.render.pdf.fonts.LazyFont.getFontFile(LazyFont.java:218)
    at
org.apache.fop.pdf.PDFDocument.makeFontDescriptor(PDFDocument.java:974)
    at org.apache.fop.pdf.PDFDocument.makeFont(PDFDocument.java:875)
    at
org.apache.fop.render.pdf.FontSetup.addToResources(FontSetup.java:250)
    at
org.apache.fop.render.pdf.PDFRenderer.stopRenderer(PDFRenderer.java:249)
    at
org.apache.fop.apps.StreamRenderer.stopRenderer(StreamRenderer.java:204)
    at org.apache.fop.fo.FOTreeBuilder.endDocument(FOTreeBuilder.java:246)
    at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
    at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
    at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at
org.apache.cocoon.core.container.handler.PoolableComponentHandler$ProxyHandler.invoke(PoolableComponentHandler.java:147)
    at $Proxy6.endDocument(Unknown Source)
    at
org.apache.cocoon.components.sax.XMLTeePipe.endDocument(XMLTeePipe.java:67)
    at
org.apache.xml.serializer.ToXMLSAXHandler.endDocument(ToXMLSAXHandler.java:181)
    at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1378)
    at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3458)
    at
org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:406)
    at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:55)
    at
org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransformer.java:585)
    at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.endDocument(Unknown
Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
    at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)


Anyone seen this before?  Thoughts/suggestions?  I'm first going to try to
change the heap memory applied to Forrest, hoping that this will change the
heap memory applied to FOP...and also maybe try updating the FOP jar that is
included with Forrest.

Mime
View raw message