You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Eduardos <ed...@yahoo.com> on 2002/04/12 02:35:41 UTC

fo:leader issue

Hi All,

   I am building the table-of-contents for a pdf
document using fop-0.20.3, XSL, and XML. Each row of
the TOC has to be in the following format:
^[----------- column 1 ----------------][-- col 2 --]$
^[title]:[subtitle].............[author][page number]$

^ - start of line
$ - end of line

I am using the code below to auto-layout the dotted
leader:

...
<fo:table-column column-width="{concat($text-width -
1.25, 'in')}"/>
<fo:table-column column-width="0.25in"/>
<fo:table-row>
   <fo:table-cell>
      <fo:block text-align="start">
         <xsl:value-of select="$title"/>
         :<xsl:value-of select="$subtitle"/>
         <fo:leader 
            leader-pattern="dots" 
            leader-pattern-width="5pt"
            leader-alignment="reference-area" 
            leader-length="100%"/>
         <xsl:value-of select="$author"/>
      </fo:block>
   </fo:table-cell>
   <fo:table-cell>
      <fo:block text-align="start">
         <fo:page-number-citation ref-id="{@id}"/>
      </fo:block>
   </fo:table-cell>
</fo:table-row>
...

The problem is that the fo:leader does not take into
account the size of the $author text and therefore
produces a longer than expected leader. If the $author
text is removed, then fo:leader works properly.

I am not sure if this is a bug in fop or if I am using
fo:leader incorrectly. 

Any help would be appriciated.

Thanks,
Ed

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: fo:leader issue

Posted by Eduardos <ed...@yahoo.com>.
Thanks for the help.

Ed
--- "J.Pietschmann" <j3...@yahoo.de> wrote:
> Eduardos wrote:
> > The problem is that the fo:leader does not take
> into
> > account the size of the $author text and therefore
> > produces a longer than expected leader.
> 
> I tried it with FOP 0.20.3 and indeed, the table
> cell
> overflows. I read the spec multiple times, and the
> interesting point seems to be, the leader is allowed
> to fill the the available space in the line up to
> the
> percentage declared in leader-length, possibly
> overflowing the region by both the space needed for
> any text before and after the leader which can't be
> stuffed into another line. This is not exactly what
> I expected, but it does not violate the spec. The
> expected behaviour, using the room provided by
> leader-length.minimum and leader-length.maximum to
> justify the text properly, is actually formulated
> as "it's common practice", some sort of weak
> recommendation.
> 
> > I am not sure if this is a bug in fop or if I am
> using
> > fo:leader incorrectly. 
> In some sense you are using fo:leader incorrectly by
> setting leader-length to 100%, which IIRC means that
> *all* values, .minimum, .optimum and .maximum are
> set
> to 100%, causing the formatter to use the full line
> width for the leader length. It ought to be a good
> idea
> to use the default values (.min=0, .opt=12pt,
> .max=100%).
> 
> It's also probably a good idea to use
> text-align="justify"
> and text-align-last="justify" to tell the formatter
> it
> should indeed try to justify. This wont work with
> the
> current FOP, and in this case it is a real bug
> (areas
> overlap).
> 
> With FOP, your best bet is to get a reasonable guess
> for
> how much space is available to the leader, assign it
> to
> leader-length.maximum, use text-align-last="justify"
> and
> put a space after the leader to allow for additional
> justification room. Unfortunately, none of the
> interesting
> stuff provided by the spec for making this a bit
> easier
> is currently implemented in FOP.
>    <fo:table-cell>
>      <fo:block
> text-align-last="justify">Title:Subtitle
>       <fo:leader leader-pattern="dots"
>        leader-length.maximum="24em"
> leader-pattern-width="5pt"/>
>       AuthorInfo</fo:block>
>    </fo:table-cell>
> 
> Some other hints:
>  > <fo:table-column
> column-width="{concat($text-width -
>  >   1.25, 'in')}"/>
> You can write this as
>   <fo:table-column column-width="{$text-width -
> 1.25}in"/>
> 
>  >  <xsl:value-of select="$title"/>
>  >  :<xsl:value-of select="$subtitle"/>
> You are introducing a white space here, which could
> induce
> an unwanted line break.
> 
> J.Pietschmann
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> fop-dev-unsubscribe@xml.apache.org
> For additional commands, email:
> fop-dev-help@xml.apache.org
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: fo:leader issue

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Eduardos wrote:
> The problem is that the fo:leader does not take into
> account the size of the $author text and therefore
> produces a longer than expected leader.

I tried it with FOP 0.20.3 and indeed, the table cell
overflows. I read the spec multiple times, and the
interesting point seems to be, the leader is allowed
to fill the the available space in the line up to the
percentage declared in leader-length, possibly
overflowing the region by both the space needed for
any text before and after the leader which can't be
stuffed into another line. This is not exactly what
I expected, but it does not violate the spec. The
expected behaviour, using the room provided by
leader-length.minimum and leader-length.maximum to
justify the text properly, is actually formulated
as "it's common practice", some sort of weak
recommendation.

> I am not sure if this is a bug in fop or if I am using
> fo:leader incorrectly. 
In some sense you are using fo:leader incorrectly by
setting leader-length to 100%, which IIRC means that
*all* values, .minimum, .optimum and .maximum are set
to 100%, causing the formatter to use the full line
width for the leader length. It ought to be a good idea
to use the default values (.min=0, .opt=12pt, .max=100%).

It's also probably a good idea to use text-align="justify"
and text-align-last="justify" to tell the formatter it
should indeed try to justify. This wont work with the
current FOP, and in this case it is a real bug (areas
overlap).

With FOP, your best bet is to get a reasonable guess for
how much space is available to the leader, assign it to
leader-length.maximum, use text-align-last="justify" and
put a space after the leader to allow for additional
justification room. Unfortunately, none of the interesting
stuff provided by the spec for making this a bit easier
is currently implemented in FOP.
   <fo:table-cell>
     <fo:block text-align-last="justify">Title:Subtitle
      <fo:leader leader-pattern="dots"
       leader-length.maximum="24em" leader-pattern-width="5pt"/>
      AuthorInfo</fo:block>
   </fo:table-cell>

Some other hints:
 > <fo:table-column column-width="{concat($text-width -
 >   1.25, 'in')}"/>
You can write this as
  <fo:table-column column-width="{$text-width - 1.25}in"/>

 >  <xsl:value-of select="$title"/>
 >  :<xsl:value-of select="$subtitle"/>
You are introducing a white space here, which could induce
an unwanted line break.

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org