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 Tobias Rettstadt <to...@rettstadt.de> on 2011/04/14 15:14:14 UTC

keep-together.within-line="always" not working with inline and hyphenation

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
-- 
View this message in context: http://old.nabble.com/keep-together.within-line%3D%22always%22-not-working-with-inline-and-hyphenation-tp31396866p31396866.html
Sent from the FOP - Users mailing list archive 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: keep-together.within-line="always" not working with inline and hyphenation

Posted by "Andreas L. Delmelle" <an...@telenet.be>.
On 14 Apr 2011, at 15:14, Tobias Rettstadt wrote:

Hi Tobias

> 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:
> <snip />
> Did I miss something or is this a bug in FOP for which I should file a bug
> reports?

This is definitely a bug/defect. Looking at the code, if I judge correctly, there is no check on whether a keep-constraint is active when hyphenation is performed.


Regards

Andreas
---

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


Re: keep-together.within-line="always" not working with inline and hyphenation

Posted by Tobias Rettstadt <to...@rettstadt.de>.
Hi Matthias,

lots of thanks. That is exactly what I was looking for.

Regards,

Tobias
-- 
View this message in context: http://old.nabble.com/keep-together.within-line%3D%22always%22-not-working-with-inline-and-hyphenation-tp31396866p31403513.html
Sent from the FOP - Users mailing list archive 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: keep-together.within-line="always" not working with inline and hyphenation

Posted by Matthias Reischenbacher <ma...@gmx.at>.
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