You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Ashish Baijal <ab...@gmail.com> on 2008/12/02 21:51:27 UTC

Fonts on Unix/Linux

Hi

I am creating a PDF in my application using XSL:FO

Following are working perfectly in Windows server but when I deploy in linux
environment, the generation fails.

FOP Version : 0.95

*Config file *
<fonts>
 <!-- Windows Dev environment configuration
          <font metrics-url="/Arial.xml" kerning="yes"
embed-url="file:///C:/WINDOWS/ Fonts/arial.ttf">
          <font-triplet name="Arial" style="normal" weight="normal"/>
          <font-triplet name="ArialMT" style="normal" weight="normal"/>
          <font-triplet name="arial" style="normal" weight="normal"/>
        </font>
       <font metrics-url="/ArialB.xml" kerning="yes"
embed-url="file:///C:/WINDOWS/Fonts/arialbd.ttf">
          <font-triplet name="Arial" style="normal" weight="bold"/>
          <font-triplet name="ArialMT" style="normal" weight="bold"/>
          <font-triplet name="arial" style="normal" weight="bold"/>
        </font>     -->
<!-- UAT Configuration        -->
   <font metrics-url="/Arial.xml" kerning="yes"
embed-url="/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf">
          <font-triplet name="Arial" style="normal" weight="normal"/>
          <font-triplet name="ArialMT" style="normal" weight="normal"/>
          <font-triplet name="arial" style="normal" weight="normal"/>
        </font>
       <font metrics-url="/ArialB.xml" kerning="yes"
embed-url="/usr/openwin/lib/X11/fonts/TrueType/Arial-Bold.ttf">
          <font-triplet name="Arial" style="normal" weight="bold"/>
          <font-triplet name="ArialMT" style="normal" weight="bold"/>
          <font-triplet name="arial" style="normal" weight="bold"/>
       </font>
       <auto-detect/>
      </fonts>

*In XSL file*
For Normal display
                            <fo:block xsl:use-attribute-sets="Arial11"
xmlns:st1="urn:schemas-microsoft-com:office:smarttags">
                                <fo:leader/>
                            </fo:block>
For Bold Display

                            <fo:block xsl:use-attribute-sets="Arial11"
font-weight="bold" xmlns:st1="urn:schemas-microsoft-com:office:smarttags">
                                <fo:leader/>
                            </fo:block>

  <xsl:attribute-set name="Arial11" >
      <xsl:attribute name="font-size">0.95em</xsl:attribute>
      <xsl:attribute name="font-family">Arial</xsl:attribute>
      <xsl:attribute name="display-align">center</xsl:attribute>
      <xsl:attribute name="language">EN-US</xsl:attribute>
  </xsl:attribute-set>
*
On Console*

[2008-12-02 12:23:01,915] [pool-1-thread-12] ERROR FopDocumentRenderSystem -
javax.xml.transform.TransformerException: org.xml.sax.SAXException:
Mismatch: page-sequence (http://www.w3.org/1999/XSL/Format) vs. root (
http://www.w3.org/1999/XSL/Format)
Exception in thread "pool-1-thread-12"
com.marsh.itg.ddeepa.services.contract.bobject.exception.LogicExecutionException:
org.xml.sax.SAXException: Mismatch: page-sequence (
http://www.w3.org/1999/XSL/Format) vs. root (
http://www.w3.org/1999/XSL/Format)
        at
com..blogic.document.utils.FopDocumentRenderSystem.renderDocument(FopDocumentRenderSystem.java:164)
        at
com..blogic.document.utils.RenderSystemDocumentRenderer$RenderSystemInputStreamProvider$1.run(RenderSystemDocumentRenderer.java:75)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

Metrics URL is created using the following command

java -cp
./fop-0.95-1.jar:./xmlgraphics-commons-1.3.1.jar:commons-logging-1.0.4.jar:./commons-io-1.3.1.jar
org.apache.fop.fonts.apps.TTFReader  -enc ansi
/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf Arial.xml

I tried to generate the file using with and without the -enc option. On
windows I found that only the file created with -enc works. Without the
option I get font error when PDF is generated on Windows and only dots
appear.

The autodetect feature loads all the fonts but substitute with "any" before
displaying.

After dicussion with Jeremias I made the following changes

Since 0.95 doesn't require embed file the new config file looks like

   <font embed-url="/usr/openwin/lib/X11/fonts/TrueType/Arial.ttf">
          <font-triplet name="Arial" style="normal" weight="normal"/>
          <font-triplet name="ArialMT" style="normal" weight="normal"/>
          <font-triplet name="arial" style="normal" weight="normal"/>
        </font>

After making this change I got the following error

[2008-12-02 14:07:23,467] [pool-1-thread-1] ERROR LazyFont - Failed to read
font metrics file null
java.io.IOException: Cannot load font: failed to create InputStream from
Source for font file /usr/openwin/lib/X11/fonts/TrueType/Arial.ttf
        at org.apache.fop.fonts.FontLoader.openFontUri(FontLoader.java:143)
        at
org.apache.fop.fonts.truetype.TTFFontLoader.read(TTFFontLoader.java:54)
        at org.apache.fop.fonts.FontLoader.getFont(FontLoader.java:164)
        at org.apache.fop.fonts.FontLoader.loadFont(FontLoader.java:113)
        at org.apache.fop.fonts.LazyFont.load(LazyFont.java:126)
        at org.apache.fop.fonts.LazyFont.getAscender(LazyFont.java:233)
        at org.apache.fop.fonts.Font.getAscender(Font.java:96)
        at
org.apache.fop.layoutmgr.BlockLayoutManager.initialize(BlockLayoutManager.java:87)
        at
org.apache.fop.layoutmgr.AbstractLayoutManager.getChildLM(AbstractLayoutManager.java:118)
        at
org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:77)
        at
org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:145)
        at
org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:552)
        at
org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:137)
        at
org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:302)
        at
org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:264)
        at
org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:106)
        at
org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:234)
        at
org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:123)
        at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:340)
        at
org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:169)
        at
org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:309)
        at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:716)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
        at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:710)
        at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:425)
        at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
        at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2160)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1213)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
        at
com.blogic.document.utils.FopDocumentRenderSystem.renderDocument(FopDocumentRenderSystem.java:159)
        at
com.blocal.blogic.document.utils.RenderSystemDocumentRenderer$RenderSystemInputStreamProvider$1.run(RenderSystemDocumentRenderer.java:75)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

If I use the auto-detect feature, The PDF gets printed but on console I see
the warning. The Fonts are default Times font

[2008-12-02 14:12:58,331] [pool-1-thread-3] WARN  FontInfo - Font
'Arial,normal,400' not found. Substituting with 'any,normal,400'.


I have double checked and am using fop 0.95 in my lib folder.

Any help will be appreciated.

Thanks
Ashish

Re: Fonts on Unix/Linux

Posted by Ashish Baijal <ab...@gmail.com>.
I do have all the fonts loaded in /usr/openwin/lib/X11/fonts/TrueType/

Is there any way I can verify that the fonts that are present in linux
folder not Microsoft fonts?


On Tue, Dec 2, 2008 at 4:16 PM, Razi Khaja <ra...@gmail.com> wrote:

> Im new to this list and just getting familiar with FOP, so my suggestion
> might be a shot in the dark.  You might want to install Microsoft fonts on
> your linux distribution.  Some useful resources might be:
>
> http://corefonts.sourceforge.net/
> http://en.opensuse.org/Optimal_Use_of_Fonts_on_SuSE
> http://avi.alkalay.net/linux/docs/font-howto/Font.html
>
> HTH
> Razi
>

Re: Fonts on Unix/Linux

Posted by Razi Khaja <ra...@gmail.com>.
Im new to this list and just getting familiar with FOP, so my suggestion
might be a shot in the dark.  You might want to install Microsoft fonts on
your linux distribution.  Some useful resources might be:

http://corefonts.sourceforge.net/
http://en.opensuse.org/Optimal_Use_of_Fonts_on_SuSE
http://avi.alkalay.net/linux/docs/font-howto/Font.html

HTH
Razi

AW: Fonts on Unix/Linux

Posted by Georg Datterl <ge...@geneon.de>.
> If I use the auto-detect feature, The PDF gets printed but on console
> I see the warning. The Fonts are default Times font
> [2008-12-02 14:12:58,331] [pool-1-thread-3] WARN  FontInfo - 
> Font 'Arial,normal,400' not found. Substituting with 'any,normal,400'.
> I have double checked and am using fop 0.95 in my lib folder.

Some mostly obvious things to check: 

Is <base> correct? 
Is your Linux enviroment using a different root directory?
And the hint which usually solves my problems: Linux is case sensitive, Windows is not. Are your font filenames correct?

Regards,
 
Georg Datterl
 
------ Kontakt ------
 
Georg Datterl
 
Geneon media solutions gmbh
Gutenstetter Straße 8a
90449 Nürnberg
 
HRB Nürnberg: 17193
Geschäftsführer: Yong-Harry Steiert 

Tel.: 0911/36 78 88 - 26
Fax: 0911/36 78 88 - 20
 
www.geneon.de
 
Weitere Mitglieder der Willmy MediaGroup:
 
IRS Integrated Realization Services GmbH:    www.irs-nbg.de 
Willmy PrintMedia GmbH:                            www.willmy.de
Willmy Consult & Content GmbH:                 www.willmycc.de 



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org