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 Brad Smith <us...@gmail.com> on 2010/02/01 23:21:09 UTC

Adding an image or character to denote line-wrap locations?

To prevent truncated lines, my stylesheets currently have <screen>,
<programlisting>, etc map to fo:blocks with wrap-option="wrap". It
would be really nice, though, if locations where line wraps are
inserted could be denoted with some kind of graphic, or even a simple
'\'. I've got a script that can do this, but it's a bit unreliable,
since all it can do is count characters to figure out where lines
should break. Does anyone know of a better way of dealing with this
problem?

Thanks!
--Brad

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


Re: Adding an image or character to denote line-wrap locations?

Posted by Jared Smith <js...@digium.com>.
----- "Vincent Hennebert" <vh...@gmail.com> wrote:
> The requirements of the present case are different. Stylesheets doing
> things like the above are just abusing the hyphenation-character
> property.

Thanks for enlightening me.  That makes more sense now.  Still, I'm wondering if the inability to add a line-wrap character for verbatim sections is a limitation of FOP or XSL-FO in general.

-- 
Jared Smith
Digium, Inc.

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


Re: Adding an image or character to denote line-wrap locations?

Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Jared,

Jared Smith wrote:
> On Tue, 2010-02-09 at 11:03 +0000, Vincent Hennebert wrote:
>> To my knowledge there is no possibility to achieve that in plain XSL-FO.
>> I think the best way of handling this issue is to perform line breaks
>> manually. That’s probably what you want anyway, as you will break at
>> sensible places while an automatic process would blindly break after,
>> say, each 80 characters, be it in the middle of a keyword or not.
> 
> Is this simply a missing feature in FOP, or something missing in XSL-FO?
> I see many XSL stylesheets do something like:
> 
> <xsl:attribute-set name="monospace.verbatim.properties"
> use-attribute-sets="verbatim.properties monospace.properties">
>    <xsl:attribute name="text-align">start</xsl:attribute>
>    <xsl:attribute name="wrap-option">wrap</xsl:attribute>
>    <xsl:attribute name="hyphenation-character">\</xsl:attribute>
> </xsl:attribute-set>
> 
> But FOP doesn't even add the hyphenation character at all when it wraps
> a long line.

It does. Like its name indicates, the hyphenation-character property
specifies which character should be used when hyphenating a word. So it
will be used only when a line break occurs within a word.

The requirements of the present case are different. Stylesheets doing
things like the above are just abusing the hyphenation-character
property.

HTH,
Vincent


> --
> Jared Smith
> Digium, Inc.

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


Re: Adding an image or character to denote line-wrap locations?

Posted by Jared Smith <js...@digium.com>.
On Tue, 2010-02-09 at 11:03 +0000, Vincent Hennebert wrote:
> To my knowledge there is no possibility to achieve that in plain XSL-FO.
> I think the best way of handling this issue is to perform line breaks
> manually. That’s probably what you want anyway, as you will break at
> sensible places while an automatic process would blindly break after,
> say, each 80 characters, be it in the middle of a keyword or not.

Is this simply a missing feature in FOP, or something missing in XSL-FO?
I see many XSL stylesheets do something like:

<xsl:attribute-set name="monospace.verbatim.properties"
use-attribute-sets="verbatim.properties monospace.properties">
   <xsl:attribute name="text-align">start</xsl:attribute>
   <xsl:attribute name="wrap-option">wrap</xsl:attribute>
   <xsl:attribute name="hyphenation-character">\</xsl:attribute>
</xsl:attribute-set>

But FOP doesn't even add the hyphenation character at all when it wraps
a long line.

--
Jared Smith
Digium, Inc.


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


Re: Adding an image or character to denote line-wrap locations?

Posted by Vincent Hennebert <vh...@gmail.com>.
Hi Brad,

Brad Smith wrote:
> To prevent truncated lines, my stylesheets currently have <screen>,
> <programlisting>, etc map to fo:blocks with wrap-option="wrap". It
> would be really nice, though, if locations where line wraps are
> inserted could be denoted with some kind of graphic, or even a simple
> '\'. I've got a script that can do this, but it's a bit unreliable,
> since all it can do is count characters to figure out where lines
> should break. Does anyone know of a better way of dealing with this
> problem?

To my knowledge there is no possibility to achieve that in plain XSL-FO.
I think the best way of handling this issue is to perform line breaks
manually. That’s probably what you want anyway, as you will break at
sensible places while an automatic process would blindly break after,
say, each 80 characters, be it in the middle of a keyword or not.

Try and determine how many characters you can put on a line, manually do
your line breaking, then disable automatic line breaking by setting
wrap-option="no-wrap".

HTH,
Vincent


> Thanks!
> --Brad

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