[prev in list] [next in list] [prev in thread] [next in thread]
List: fop-user
Subject: RE: when apache FOP will full support font-family lists and font-selection-strategy ?
From: "Pascal Sancho" <pascal.sancho () takoma ! fr>
Date: 2005-12-27 9:57:25
Message-ID: 743B49C43C0964459527F8E8D4B04D8A399EA6 () mercure ! takoma ! fr
[Download RAW message or body]
Hi Guangxian Zou,
You can try to modify this following snippet (full xslt 1.0) to use it with chinese \
characters.
This works fine with Greek charaters that are in the symbol charset but not in the \
standard charsets (serif/sans serif/courrier).
You just need to replace $expression with chinese characters and choose appropriate \
fo:inline/@font-family...
Note: the 1st $expression character is used to replace non latin characters in the \
translate() function.
Hope that helps you
Pascal
<xsl:template match="text()">
<xsl:call-template name="testChar">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template name="testChar">
<xsl:param name="text"/>
<xsl:variable name="expression">ΑΒΓΔΕΖ \
97;ΘΙΚΛΜΝΞΟΠΡ&#x \
03A3;ΤΥΦΧΨΩαβγδ& \
#x03B5;ζηθικλμνξο \
;πρςστυφχψωϑϒϕϖ</xsl:variable>
<xsl:variable name="textTemplate" \
select="translate($text,$expression,'ΑΑΑΑΑΑ& \
#x0391;ΑΑΑΑΑΑΑΑΑΑ \
;ΑΑΑΑΑΑΑΑΑΑ \
91;ΑΑΑΑΑΑΑΑΑΑ&#x \
0391;ΑΑΑΑΑΑΑΑΑΑΑΑΑΑ')"/>
<xsl:choose>
<xsl:when test="contains($textTemplate,'Α')">
<xsl:variable name="textBefore" \
select="substring-before($textTemplate,'Α')"/> <xsl:variable \
name="charPosition" select="string-length($textBefore)+1"/> <xsl:value-of \
select="$textBefore"/><fo:inline font-weight="normal" \
font-family="Symbol"><xsl:value-of
select="substring($text,$charPosition,1)"/></fo:inline><xsl:call-template
name="testChar">
<xsl:with-param name="text" select="substring($text,$charPosition+1)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
> -----Message d'origine-----
> De : Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
> Envoyé : jeudi 22 décembre 2005 08:01
>
> Both properties are not fully implemented even in the latest
> release FOP 0.90alpha1. Either you have to place either the
> Chinese or the English text in fo:inlines and specify the
> different fonts on the inlines or if you have a TrueType font
> that supports both Chinese and English characters you can
> have them mixed. The other option is to help us implement
> font-selection-strategy and font-family lists.
>
> On 21.12.2005 14:24:05 Guangxian Zou wrote:
> > thanks fop developers. :) i am using fop to translate xml to fo and
> > then to pdf. :) I want to mixing chinese and english font, when
> > print/render english use english font, and when print/render chinese
> > character use chinese font. :) but I don't know how to do that in the
> > current fop version (0.20.5).
> > can you give me some advice ? thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic