xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.Pietschmann" <j3322...@yahoo.de>
Subject Re: br line breaks problem (xml-fop-pdf)
Date Thu, 05 Sep 2002 20:44:40 GMT
[m] zentrale | alex jaus wrote:
> i have a xml-file, in which the line break of the text is formattet
> with <br/>-tags like this:
> 
> blablablablablabla <br/>
> <br/>
> blablablablablabla, blablablablablabla
> blablablablablabla
> 
> the <br> tag is in my pdf.xsl like this:
> <!-- Breaks <br> definieren -->
> <xsl:template match="br">
> 	<fo:block/>
> </xsl:template>
> 
> my problem is, that if i generate the pdf, the line breaks are not correctly
> fomattet.
..
> why? do you have an answer?

It's again time to bemoan the decline of the customs
of fine typography. For the uninitiated, dabblers and
Heathens out there:
   THOU SHALT NOT MAKE SPACE WITH EMPTY LINES
This is what the space-before and space-after properties
are for.
(BTW spelling skill seems to have been decayed too)

Apart from this, the spec leaves some details open in
the definition of the semantics of <fo:block/>, but it
is *not* the same as a line break in any case.
FOP generates a block area with zero heigth. The effect
of two <fo:block/> is to place two zero heigth block
areas there which cannot be distinguished from having
one.

One possibility to fix this would be to place a &#160; in
the block.
Using space is a bit trickier, probably something like
  <xsl:template match="br">
    <fo:block>
      <xsl:if test="previous-sibling::*[self::br]
        and normalize-space(previous-sibling::node()[1]
             [previous-sibling::*[self::br]])=''">
        <xsl:attribute name="space-before">
         <xsl:text>inherited-property-value(font-size)</xsl:text>
        </xsl:attribute>
      </xsl:if>
    </fo:block>
  </xsl:template>
(Beware: untested)

The advantage of using space is that it would be handled
properly at page breaks, if this were fully implemented
in FOP (the redesigned version will do so).

J.Pietschmann


Mime
View raw message