Paul Suart
Paul Suart

Reputation: 6713

How can I specify line-length behaviour in Apache FOP?

Output from Ecrion and Apache FOP

I have rendered the same XSL-FO in a trial of Ecrion and Apache FOP, and you'll notice that the two renderers have produced different line-lengths on lines 2 and 3. The way Ecrion has rendered the text is the way I would like Apache FOP to do it.

Is there an attribute I can add to the <fo:block> containing the text that would cause FOP to render the text with the same line length as Ecrion? Is there a command-line switch I can pass to FOP to obtain this behaviour?

Upvotes: 0

Views: 305

Answers (1)

Paul Suart
Paul Suart

Reputation: 6713

Looking at the source, there is only a single implementation of a line breaking algorithm present.

In LineLayoutManager.java there's a private method called "findOptimalBreakingPoints". Around line 834-ish I commented-out the lines that increment "maxAdjustment" and the "balancing" of the lines no longer occurs.

I'm aware this is a hacky solution, but I didn't have the time to investigate further and write my own line breaking algorithm.

Upvotes: 0

Related Questions