xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Lalevee <nicol...@anyware-tech.com>
Subject Chinese hyphenation particularity
Date Mon, 06 Mar 2006 09:48:24 GMT
Hi everybody,

I have succeeded in producing a chinese PDF from an XML document via a
XSL transformation.
There is a last problem. The professional chinese document should not
let a chinese character alone on a line.
For instance, I have the sentense "AZERTYUIO." to render in PDF. FOP
(with the patch of the bug 36977 for the trunk version), generate a PDF
with :

And, for chinese people, that's not a well rendered document. The
prefered layout is :
AZERTYUIO. (the characters have to be compressed)
AZERTYU (the characters have to be expanded)

The only way I found to do so is to force the last three characters of a
text to be "no-wrap". Here is my XSL template :

    <xsl:template match="text()">
        <xsl:variable name="txt">
            <xsl:call-template name="string.subst">
                <xsl:with-param name="string">
                    <xsl:call-template name="string.subst">
                        <xsl:with-param name="string">
                            <xsl:call-template name="string.subst">
                                <xsl:with-param name="string" select="." />
                                <xsl:with-param name="target"
select="'.'" />
                                <xsl:with-param name="replacement"
select="'.&#x200B;'" />
                        <xsl:with-param name="target" select="'\'" />
                        <xsl:with-param name="replacement"
select="'\&#x200B;'" />
                <xsl:with-param name="target" select="'/'" />
                <xsl:with-param name="replacement" select="'/&#x200B;'" />
            <xsl:when test="string-length($txt) > 3">
                <xsl:value-of select="substring($txt, 1,
string-length($txt)-3)" />
                <fo:inline wrap-option="no-wrap" hyphenate="false"
                    <xsl:value-of select="substring($txt,
string-length($txt)-2, string-length($txt))" />
                <xsl:value-of select="$txt" />

And that's a not good solution because some ends of line can be missed.
In my XML source document, I can have inline formatting properties, like
bold or italic, that makes the text sequence shorter than 3, even if the
complete sentense contains more than 3 characters.

Is there any other way to handle this hyphenation particularity ?

Thanks in advance

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

View raw message