Dear FOP-DEV,

I'm using FOP to create a PDF version of an XML document.  I've been
using it for a few months, and have recently upgraded to version
0.20.1.  I have come across various things that could be mistakes on
my part or possibly problems with FOP.  Any suggestions as to what is
going on would be much appreciated.  A couple of example FO files
illustrating these issues follow.

(1) text-decoration="underline" works on fo:inline but not on
fo:block.  If I write <fo:block text-decoration="underline">,
shouldn't the entire contents of the block be underlined?

(2) background-color="blue" works on fo:block but not on fo:inline.
If I write <fo:inline background-color="blue">, shouldn't the contents
of the inline be given a blue background?

(3) A block containing a single long word is not hyphenated - why not?

(4) Possibly related, a block containing a single long word with
whitespace before and after causes a run-time error!

(5) An <fo:instream-foreign-object> containing an SVG doesn't seem to
get the correct height from the SVG.

(6) SVG containing stroke-dasharray="0.2" creates bad PDF; acroread
complains about "bad dash parameters".  It may be that all values less
than 1 fail.

Here's some FO that illustrates these points:


<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
  <fo:layout-master-set>
    <fo:simple-page-master margin-right="25mm" margin-left="25mm"
                           margin-bottom="20mm" margin-top="15mm"
                           page-height="297mm" page-width="210mm"
                           master-name="a4">
      <fo:region-before extent="10mm"/>
      <fo:region-after extent="10mm"/>
      <fo:region-body margin-bottom="15mm" margin-top="15mm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-name="a4">
    <fo:flow flow-name="xsl-region-body">

      <fo:block>
        <fo:inline text-decoration="underline">
          This will be underlined because the text-decoration is set on the
          inline element.
        </fo:inline>
      </fo:block>

      <fo:block text-decoration="underline">
        This will not be underlined even though a text-decoration is set on
        the block element.  It also fails when text-decoration is set on
        basic-link elements.
      </fo:block>

      <fo:block background-color="blue">
        This will have a blue background because background-color is set on
        the block element.
      </fo:block>

      <fo:block>
        <fo:inline background-color="blue">
          This will not have a blue background even though background-color
          is set on the inline element.
        </fo:inline>
      </fo:block>

      <fo:block language="en" hyphenate="true">
        Thisparagraphwillbehyphenated becauseithasmorethanonewordinit
        andthisseemstoworkok.  Theseverylongwords existonlysothat
        thereisahighprobability thathyphenationwillberequired.
      </fo:block>

<!-- Uncommenting this block gives "ERROR: null".  This is identical to the
     next block apart from white space before and after the single very-long
     word.
     <fo:block language="en" hyphenate="true">
        
ThisparagraphwillnotbehyphenatedbecauseitcontainsonlyoneextreemelylongwordandthisdoesnotseemtoworkIwasoriginallysufferingfromthisproblemintableswithnarrowcolumnsandwiththingslikeURLsthatareoftenverylongwithnospacesinthem.
      </fo:block> -->

<!-- there should be no line breaks in the following; watch out if
they have been added "in the post". -->

      <fo:block language="en" 
hyphenate="true">ThisparagraphwillnotbehyphenatedbecauseitcontainsonlyoneextreemelylongwordandthisdoesnotseemtoworkIwasoriginallysufferingfromthisproblemintableswithnarrowcolumnsandwiththingslikeURLsthatareoftenverylongwithnospacesinthem.</fo:block>

      <fo:block>
        Following is an SVG object that should be 4cm high, but is shown
        about 5.5cm high.
      </fo:block>
      <fo:block>
        <fo:instream-foreign-object>
          <svg:svg xmlns:svg="http://www.w3.org/2000/svg";
                   width="15cm" height="4cm">
          </svg:svg>
        </fo:instream-foreign-object>
      </fo:block>
      <fo:block>
        End of SVG object.
      </fo:block>

      <fo:block>
        Following is the same SVG object that is 4cm high.
      </fo:block>
      <fo:block>
        <fo:instream-foreign-object content-height="4cm">
          <svg:svg xmlns:svg="http://www.w3.org/2000/svg";
                   width="15cm" height="4cm">
          </svg:svg>
        </fo:instream-foreign-object>
      </fo:block>
      <fo:block>
        End of SVG object.
      </fo:block>

      <fo:instream-foreign-object>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg"; fill="none" width="10cm" height="6cm" 
preserveAspectRatio="xMidYMid meet" contentScriptType="text/ecmascript" 
contentStyleType="text/css"><svg:g transform="scale(28)">
  <svg:line stroke-width="0.84" stroke-dasharray="0.2" stroke="#000000" x1="3.9" 
y1="0.2" x2="3.9" y2="5.19999"/>
</svg:g></svg:svg>
      </fo:instream-foreign-object>

    </fo:flow>
  </fo:page-sequence>
</fo:root>


A final problem:

(7) When I try this code:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
  <fo:layout-master-set>
    <fo:simple-page-master margin-right="25mm" margin-left="25mm"
                           margin-bottom="20mm" margin-top="15mm"
                           page-height="297mm" page-width="210mm"
                           master-name="a4">
      <fo:region-body margin-bottom="15mm" margin-top="15mm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-name="a4">
    <fo:flow flow-name="xsl-region-body">

      <fo:block>
        <fo:basic-link internal-destination="Y">
          X
        </fo:basic-link>
      </fo:block>

      <fo:block break-before="page"/>

      <fo:block id="Y"/>

    </fo:flow>
  </fo:page-sequence>
</fo:root>

I get this output:

FOP 0.20.1
using SAX parser org.apache.xerces.parsers.SAXParser
building formatting object tree
setting up fonts
 [1] [2ERROR: The id "Y" already exists in this document


Any help on the foregoing would be much appreciated.

I have one other problem at the moment which I have not yet narrowed
down to a simple test case, but if anyone can guess what's going on
from the following error message that would be very helpful:


javax.xml.transform.TransformerException
        at 
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1212)
        at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
        at java.lang.Thread.run(Thread.java:484)
---------
java.lang.NullPointerException
        at org.apache.fop.fo.flow.TableRow.initCellArray(TableRow.java:486)
        at org.apache.fop.fo.flow.TableRow.layout(TableRow.java:262)
        at org.apache.fop.fo.flow.Block.layout(Block.java:260)
        at org.apache.fop.fo.flow.Flow.layout(Flow.java:150)
        at org.apache.fop.fo.flow.Flow.layout(Flow.java:109)
        at org.apache.fop.fo.pagination.PageSequence.format(PageSequence.java:295)
        at org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java:166)
        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:155)
        at 
org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:284)
        at 
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:749)
        at 
org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.java:495)
        at 
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:193)
        at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2154)
        at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2097)
        at 
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2029)
        at 
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1189)
        at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
        at java.lang.Thread.run(Thread.java:484)
ERROR: null


I am using FOP 0.20.1, but I have substituted Batik 1.1 for the 1.0
that is supplied with FOP.

Sorry this is so long: as you can tell I have been saving these up...

Many thanks in advance,

--Phil Endecott.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to