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 Joachim Pfaff <ne...@compuserve.de> on 2006/03/24 11:07:05 UTC

Questions on FOP-Trunk (text-align, keep-together, last-line-end-indent)

Hello,

as I already mentioned, I use FOP to create the printed version of an 
online magazine. Most thinks are working fine. And the result looks 
now pretty much like as it should :) 

A big 'BRAVO' to the fop-staff, and this mailinglist!

I forgot exactly why I choosed to use FOP-Trunk, but I think it was 
because of some margin/region-overflow-Problems I had with 0.91beta.

Unfortunately the last time I downloaded the FOP-Trunk via svn all my 
text-align="center" where messed up, and corresponding to [1] I 
decided to use the release 381617.

So here comes my first Question:
Is the text-alignment now corrected? 

I am using embeded fop with Java 1.5.0_06-b05 and Win XP SP2.

Another Problem:
In the TOC of my fo I use the following statement:

<fo:block space-after="3mm" text-align-last="justify" end-
indent="30mm" keep-together.within-page="always">
<fo:inline>Heinrich Heines "Religionsgespräche" sind aktueller denn 
je/ </fo:inline>
<fo:inline keep-together.within-line="always">Von Ursula 
Homann<fo:leader leader-pattern="dots"/>
<fo:page-number-citation ref-id="N101C5"/>
</fo:inline>
</fo:block>

I thought the last fo:inline would say: Try always keep the things 
inside this Element on one line. But it does not work.Maybe I 
misunderstood the property in combination with the fo:inline. Can 
anyone help?

I placed a sample fo, and the resulting pdf under [2] and [3].

I do *not* want the "Von Ursula Homan" apearing on one single line. I 
just want them *always* keeped together. A small but important 
difference ;)

And last but in no way least:
Is it planed, that fop will implement last-line-end-indent? This 
property is IMHO pretty important, for professional TOCs.

I did never worked in an Open-Source project, but i think that I am 
not the worst java-coder. So what do you think how hard would it be, 
implementing it?

Greetings!
Joachim

[1] http://www.nabble.com/text-align-broken--t1246497.html#a3316241
[2] http://www.dajunkie.de/xslfotestv2.zip
[3] http://www.dajunkie.de/foptestv2.pdf



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


Re: Questions on FOP-Trunk (text-align, keep-together, last-line-end-indent)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Joachim, I'm not so sure it this is really wrong. The spec says in 7.15.3:

"Specifies an indent to be applied to the last line-area child of the
last block-area generated and returned by the formatting object, and to
any line-area generated by the formatting object whose following sibling
is a block-area that is not a line-area. It is added to the block's
end-edge. Positive values indent the edge, negative values outdent the
edge."

"Specifies an indent" sounds to me like it is applied in addition to
other indents like end-indent. IMO, you'd have to specify
last-line-end-indent="-30mm" to get the effect you want. BTW, XEP does
the same. AltSoft seems to have a problem with the test case but if I
adjust your example it renders it like FOP. I agree the text is perhaps
not 100% clear, but I don't think that last-line-end-indent overrules
end-indent in this case. Maybe one of the other Foppies could give his
interpretation....

Here's the test case I wrote for the property:
http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_last-line-end-indent.xml

On 24.03.2006 16:50:48 Joachim Pfaff wrote:
> Thanks for the good news Jeremias,
> 
> here are some bad ones, as you will see at the end of this mail :(
> 
> > There's a special case (nested blocks) which shows a misinterpretation
> > of the spec which I'm going to correct as one of my next tasks. Might as
> > well do the same for last-line-end-indent while I'm at it. Shouldn't be
> > a big deal.
> 
> What does 'nested blocks' mean in this case? I changed my xslt, so 
> that i have no <fo:block> <fo:block> </fo:block> </fo:block> in my 
> .fo, and the output is not correct. Not correct as i understood last-
> line-end-indent.
> 
> I placed another .fo and the generated pdf under [1] and [2]. This 
> time using last-line-end-indent.
> 
> The last line in the body of the first page 
> "Heinrich Heines Lachen/ Von Ralf 
> Schnell................................. 3" 
> has still an end-indent of 3mm.
> 
> I am using fop-trunk rev 388560 (with working text-indents :) )
> 
> Could you supply your example in which you use the last-line-end-
> indent? Maybe .....
> 
> Between the maybe and now a I cheked something and am sorry to say: 
> Stop marking the last-line-end-indent as working on the compliance 
> page :(
> 
> last-line-end-indent works when you supply a bigger value than in end-
> 
> indent. But when you supply a smaler value, as I do, nothing happens.
> 
> The provided examples demonstrate the problem. 
> 
> Greetings!
> 
> Joachim
> 
> [1] http://www.dajunkie.de/druckfassung.zip
> [2] http://www.dajunkie.de/druckfassung.pdf


Jeremias Maerki


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


Re: Questions on FOP-Trunk (text-align, keep-together, last-line-end-ind

Posted by "Peter B. West" <li...@pbw.id.au>.

Jeremias Maerki-2 wrote:
> 
> 
> On 24.03.2006 11:07:05 Joachim Pfaff wrote:
> ...
> 
>> I did never worked in an Open-Source project, but i think that I am 
>> not the worst java-coder. So what do you think how hard would it be, 
>> implementing it?
> 
> Obviously, you don't need to implement last-line-end-indent, but if you
> want to take a stab at inline keep-together, that should also not be too
> difficult. The only problem is that you need to have some basic
> knowledge about the Knuth element model. Implementing keeps simply means
> switching off break possibilities in terms of the Knuth model. The
> absolutely essential basics are here:
> http://wiki.apache.org/xmlgraphics-fop/KnuthsModel
> But the paper referenced on that page helps much more. If you're serious
> about it I can point you to the right places in the code.
> 
> 
Alternatively, see <http://defoe.sourceforge.net/folio/knuth-plass.html>.
--
View this message in context: http://www.nabble.com/Questions-on-FOP-Trunk-%28text-align%2C-keep-together%2C-last-line-end-indent%29-t1335533.html#a3591321
Sent from the FOP - Users forum at Nabble.com.


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


Re: Questions on FOP-Trunk (text-align, keep-together, last-line-end-indent)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 27.03.2006 13:29:49 Joachim Pfaff wrote:
> Okay Commander,
> 
> bring me there ;)

hehe

> I have already taken a look at the 
> org.apache.fop.layoutmgr.inline.InlineLayoutManager. Is it correct 
> that most of the work has to be done  in this class (especially 
> mustKeepTogether() and getNextKnuthElements())?

Yes, although I've just seen that mustKeepTogether() should be treated
with care. The reason: There are two dimensions, 1. keeps in
block-progression-direction (keep-together.within-page="always", implemented)
and 2. keeps in inline-progression-dimension
(keep-together.within-line="always", not implemented). Since fo:inline
can have fo:block as child, I think the mustKeepTogether() is used here
for block-p-d. That means, we need something else for inline-p-d.

But yes, the construction of the element list happens in
getNextKnuthElements(). That's where all the fun happens (or in
submethods called from there.

> But I do not understand how a Knuth-Sequence is marked to keep 
> together. 

That's where Donald Knuth's book helps a lot. :-) Here's a Knuth element
model crash course (doesn't replace the book!):

There are three elements:
- box
- glue
- penalty

There are two possibilities where a line-break can occur:
1. at a penalty, if the penalty value is < infinity
2. at a glue, if the previous element is a box

To implement a keep, all you need to do is make sure there are no break
possibilities. :-) For case 1: set the penalty value to "infinity". For
case 2: insert an infinite penalty before the glue.

Since inline element list build is a complicated thing and we require
them anyway, it's a VERY good idea to create layout engine test cases 
(see test/layoutengine/standard-testcases) where you define the expected
outcome. A guide to creating layout engine test cases can be found here:
http://wiki.apache.org/xmlgraphics-fop/HowToCreateLayoutEngineTests

That's it for now. If you need more we should really move this to the
fop-dev mailing list. It gets a little inappropriate for fop-users. If
you don't mind...

> I think that you are right about the last-line-end-indent. I thought 
> this property has the same context as end-indent. Thats not correct, 	
> even though the name could implicate this.
> 
> Greetings!
> Joachim
> 
> 
> On 24 Mar 2006 at 14:47, Jeremias Maerki wrote:
> > Obviously, you don't need to implement last-line-end-indent, but if you
> > want to take a stab at inline keep-together, that should also not be too
> > difficult. The only problem is that you need to have some basic
> > knowledge about the Knuth element model. Implementing keeps simply means
> > switching off break possibilities in terms of the Knuth model. The
> > absolutely essential basics are here: http://wiki.apache.org/xmlgraphics-fop/KnuthsModel
> > But the paper referenced on that page helps much more. If you're serious
> > about it I can point you to the right places in the code.


Jeremias Maerki


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


Re: Questions on FOP-Trunk (text-align, keep-together, last-line-end-indent)

Posted by Joachim Pfaff <ne...@compuserve.de>.
Thanks for the good news Jeremias,

here are some bad ones, as you will see at the end of this mail :(

> There's a special case (nested blocks) which shows a misinterpretation
> of the spec which I'm going to correct as one of my next tasks. Might as
> well do the same for last-line-end-indent while I'm at it. Shouldn't be
> a big deal.

What does 'nested blocks' mean in this case? I changed my xslt, so 
that i have no <fo:block> <fo:block> </fo:block> </fo:block> in my 
.fo, and the output is not correct. Not correct as i understood last-
line-end-indent.

I placed another .fo and the generated pdf under [1] and [2]. This 
time using last-line-end-indent.

The last line in the body of the first page 
"Heinrich Heines Lachen/ Von Ralf 
Schnell................................. 3" 
has still an end-indent of 3mm.

I am using fop-trunk rev 388560 (with working text-indents :) )

Could you supply your example in which you use the last-line-end-
indent? Maybe .....

Between the maybe and now a I cheked something and am sorry to say: 
Stop marking the last-line-end-indent as working on the compliance 
page :(

last-line-end-indent works when you supply a bigger value than in end-

indent. But when you supply a smaler value, as I do, nothing happens.

The provided examples demonstrate the problem. 

Greetings!

Joachim

[1] http://www.dajunkie.de/druckfassung.zip
[2] http://www.dajunkie.de/druckfassung.pdf



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


Re: Questions on FOP-Trunk (text-align, keep-together, last-line-end-indent)

Posted by Joachim Pfaff <ne...@compuserve.de>.
Okay Commander,

bring me there ;)

I have already taken a look at the 
org.apache.fop.layoutmgr.inline.InlineLayoutManager. Is it correct 
that most of the work has to be done  in this class (especially 
mustKeepTogether() and getNextKnuthElements())?

But I do not understand how a Knuth-Sequence is marked to keep 
together. 

I think that you are right about the last-line-end-indent. I thought 
this property has the same context as end-indent. Thats not correct, 	
even though the name could implicate this.

Greetings!
Joachim


On 24 Mar 2006 at 14:47, Jeremias Maerki wrote:
> Obviously, you don't need to implement last-line-end-indent, but if you
> want to take a stab at inline keep-together, that should also not be too
> difficult. The only problem is that you need to have some basic
> knowledge about the Knuth element model. Implementing keeps simply means
> switching off break possibilities in terms of the Knuth model. The
> absolutely essential basics are here: http://wiki.apache.org/xmlgraphics-fop/KnuthsModel
> But the paper referenced on that page helps much more. If you're serious
> about it I can point you to the right places in the code.


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


Re: Questions on FOP-Trunk (text-align, keep-together, last-line-end-indent)

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 24.03.2006 11:07:05 Joachim Pfaff wrote:
> Hello,
> 
> as I already mentioned, I use FOP to create the printed version of an 
> online magazine. Most thinks are working fine. And the result looks 
> now pretty much like as it should :) 
> 
> A big 'BRAVO' to the fop-staff, and this mailinglist!
> 
> I forgot exactly why I choosed to use FOP-Trunk, but I think it was 
> because of some margin/region-overflow-Problems I had with 0.91beta.
> 
> Unfortunately the last time I downloaded the FOP-Trunk via svn all my 
> text-align="center" where messed up, and corresponding to [1] I 
> decided to use the release 381617.
> 
> So here comes my first Question:
> Is the text-alignment now corrected? 

Yes.

> I am using embeded fop with Java 1.5.0_06-b05 and Win XP SP2.
> 
> Another Problem:
> In the TOC of my fo I use the following statement:
> 
> <fo:block space-after="3mm" text-align-last="justify" end-
> indent="30mm" keep-together.within-page="always">
> <fo:inline>Heinrich Heines "Religionsgespräche" sind aktueller denn 
> je/ </fo:inline>
> <fo:inline keep-together.within-line="always">Von Ursula 
> Homann<fo:leader leader-pattern="dots"/>
> <fo:page-number-citation ref-id="N101C5"/>
> </fo:inline>
> </fo:block>
> 
> I thought the last fo:inline would say: Try always keep the things 
> inside this Element on one line. But it does not work.Maybe I 
> misunderstood the property in combination with the fo:inline. Can 
> anyone help?

Hmm, yeah, inline keeps don't work, yet. Unfortunately. Although it
would probably not be a big deal to implement them. I guess I should
finally update the compliance page so this is highlighted.

> I placed a sample fo, and the resulting pdf under [2] and [3].
> 
> I do *not* want the "Von Ursula Homan" apearing on one single line. I 
> just want them *always* keeped together. A small but important 
> difference ;)
> 
> And last but in no way least:
> Is it planed, that fop will implement last-line-end-indent? This 
> property is IMHO pretty important, for professional TOCs.

What a big box of secrets FOP still is sometimes: Although the
compliance lists this property as unsupported, it actually works. I'm
just now writing a test case for it and I will update the compliance
page afterwards. Your post shows: Don't trust the compliance page. :-)

It seems that the property has the same problem as text-indent, however.
There's a special case (nested blocks) which shows a misinterpretation
of the spec which I'm going to correct as one of my next tasks. Might as
well do the same for last-line-end-indent while I'm at it. Shouldn't be
a big deal.

> I did never worked in an Open-Source project, but i think that I am 
> not the worst java-coder. So what do you think how hard would it be, 
> implementing it?

Obviously, you don't need to implement last-line-end-indent, but if you
want to take a stab at inline keep-together, that should also not be too
difficult. The only problem is that you need to have some basic
knowledge about the Knuth element model. Implementing keeps simply means
switching off break possibilities in terms of the Knuth model. The
absolutely essential basics are here: http://wiki.apache.org/xmlgraphics-fop/KnuthsModel
But the paper referenced on that page helps much more. If you're serious
about it I can point you to the right places in the code.



Jeremias Maerki


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