xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Reischenbacher <matthias8...@gmx.at>
Subject Re: keep-together.within-line="always" not working with inline and hyphenation
Date Thu, 14 Apr 2011 20:32:59 GMT
Hi Tobias,

a possible workaround for this bug is to wrap every text character in a 
fo:character element and set its hyphenate attribute to false.

Here is a XSL example for doing that:

<xsl:template match="text()" mode="join">
<xsl:call-template name="doJoin">
<xsl:with-param name="text" select="string(.)"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="doJoin">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="string-length($text) &gt; 0">
<xsl:variable name="char" select="substring($text, 1, 1)"/>
<fo:character character="{$char}" hyphenate="false"/>
<xsl:call-template name="doJoin">
<xsl:with-param name="text" select="substring($text, 2)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

I'd also advice to use latest trunk because 1.0 has a bug which causes a 
NullPointerException when a white-space fo:character element is used as 
the first element inside a fo:block. See also:
https://issues.apache.org/bugzilla/show_bug.cgi?id=50988

HTH,
Matthias

On 14.04.2011 10:14, Tobias Rettstadt wrote:
> Hi FOP experts,
>
> I hope you can help me with my problem.
>
> As I understand from the specification and previous posts, an inline with
> keep-together.within-line="always" should prevent hyphenation of the
> containing text by ensuring that it is rendered on the same line. But that
> does not seem to work in my case:
>
> http://old.nabble.com/file/p31396866/test.fo test.fo
> http://old.nabble.com/file/p31396866/test.pdf test.pdf
>
> The word hyphenation is hyphenated despite the keep-together attribute. The
> results can be reproduced with version 1.0 and the trunk version. The
> following hyphenation patterns were used:
>
> http://sourceforge.net/projects/offo/
>
> Did I miss something or is this a bug in FOP for which I should file a bug
> reports?
>
> Thanks in advance,
>
> Tobias

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


Mime
View raw message