W3C home > Mailing lists > Public > www-xsl-fo@w3.org > March 2014

Re: How to mark wrapped lines?

From: Tony Graham <tgraham@mentea.net>
Date: Mon, 10 Mar 2014 21:36:27 -0000 (GMT)
Message-ID: <63824.83.147.131.233.1394487387.squirrel@squirrelmail.webfaction.com>
To: www-xsl-fo@w3.org
On Sat, March 8, 2014 10:21 pm, Christian Franke wrote:
> I would like to typeset some source code and automatically wrap lines.
>
> This should be possible without a loss of information iff there is some
> kind of marking which allows the reader to recognize wrapped lines.
>
> Is that somehow possible with xsl-fo?

Not out of the box.

If you know the line width, you could break the lines yourself using XSLT
and insert a marking character, but then the line breaks and marking
characters would be included if someone copied the source code from PDF
output or similar.

You could put every line in a separate fo:block and alternate
background-color of alternate fo:block.

If your FO formatter supports change-bars, you could use one
fo:change-bar-begin/fo:change-bar-end for the entire source code listing
and at the start of every line add another
fo:change-bar-start/fo:change-bar-end for a different change-bar-class
with a higher z-index and a width and style such that the change-bars for
the start of the lines overlay the other change-bar with the background
color so that you only see the other change-bar alongside the continuation
lines (and hopefully don't see a succession of hairline change-bars where
the per-line change-bars don't quite overlap).

Keeping with the change-bar idea, you could alternate change-bars of
different colours on alternate lines.

If you use the line-numbering extension in Antenna House, it will number
the formatted lines, not the source lines, so a wrapped line will show as
multiple line numbers.

If you are using Antenna House, you might be able to try setting
"hyphenation-charater" and "axf:soft-hyphen-treatment", but I wouldn't be
too hopeful.

FWIW, improved line numbering was in the XSL-FO 2.0 requirements [1] and
made an appearance in the XSL-FO 2.0 WD [2], but that has been shelved.

Regards,


Tony Graham                                         tgraham@mentea.net
Consultant                                       http://www.mentea.net
Chair, Print and Page Layout Community Group @ W3C    XML Guild member
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
Mentea       XML, XSL-FO and XSLT consulting, training and programming

[1] http://www.w3.org/TR/xslfo20-req/#additional-numbering
[2] http://www.w3.org/TR/xslfo20/#fo_number
Received on Monday, 10 March 2014 21:36:51 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:37 UTC