There's not much else you can do other than to try to handle/work-around
everything in XSLT. FOP does not have special code to handle languages
like Chinese. We lack the knowledge set in the project team. Every now
and then we talk about implementing UAX#14 line breaking but so far
nobody had the resources to dive into this. Any help is welcome.

On 06.03.2006 10:48:24 Nicolas Lalevee wrote:
> 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 :
> AZERTYUI
> O.
> 
> And, for chinese people, that's not a well rendered document. The
> prefered layout is :
> AZERTYUIO. (the characters have to be compressed)
> or
> AZERTYU (the characters have to be expanded)
> IO.
> 
> 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:call-template>
>                         </xsl:with-param>
>                         <xsl:with-param name="target" select="'\'" />
>                         <xsl:with-param name="replacement"
> select="'\&#x200B;'" />
>                     </xsl:call-template>
>                 </xsl:with-param>
>                 <xsl:with-param name="target" select="'/'" />
>                 <xsl:with-param name="replacement" select="'/&#x200B;'" />
>             </xsl:call-template>
>         </xsl:variable>
>         <xsl:choose>
>             <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"
> keep-together.within-line="always">
>                     <xsl:value-of select="substring($txt,
> string-length($txt)-2, string-length($txt))" />
>                 </fo:inline>
>             </xsl:when>
>             <xsl:otherwise>
>                 <xsl:value-of select="$txt" />
>             </xsl:otherwise>
>         </xsl:choose>
>     </xsl:template>
> 
> 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
> Nicolas


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to