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 Rymasz Jacky <ja...@jcdecaux.fr> on 2005/04/05 10:38:41 UTC
RE: How can I rotate text for a 90o sidebar?
This seems much cleaner than my solution indeed. ;)
Nice work!
Jack
-----Message d'origine-----
De : JBryant@s-s-t.com [mailto:JBryant@s-s-t.com]
Envoyé : jeudi 31 mars 2005 17:52
À : fop-users@xmlgraphics.apache.org
Objet : RE: How can I rotate text for a 90o sidebar?
I hadn't really looked at this because the huge indentations put me off, but
now I've gotten around to it.
You can do this without disabling escape characters and by using literal
result elements. I'm inserting the whole stylesheet because the named
template needs to be called with certain parameters rather than just the
string you want rendered in stacked blocks (though you could write a
template that would take just the string). Here's the whole stylesheet
(tested on Saxon 8):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="fo">
<xsl:template match="/">
<xsl:call-template name="scatter-string">
<xsl:with-param name="text" select="substring(.,2)"/>
<xsl:with-param name="rotated"select="substring(.,1,1)"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="scatter-string">
<xsl:param name="text"/>
<xsl:param name="rotated"/>
<fo:block><xsl:value-of select="$rotated"/></fo:block>
<xsl:if test="string-length($text) > 0">
<xsl:call-template name="scatter-string">
<xsl:with-param name="text" select="substring($text, 2)"/>
<xsl:with-param name="rotated" select="substring($text,1,1)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
The only change to the algorithm is to wrap the block around the result
rather than to insert it into a variable. Other than that, I removed all the
variables, as they were getting used only once. Instead, I put the values
that were going into the variables into the parameters. I also moved the
selects into the parameters and reduced the choose to an if, since the
otherwise was empty anyway.
FWIW
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
Louis.Masters@log-net.com
03/30/2005 07:25 AM
Please respond to
fop-users@xmlgraphics.apache.org
To
fop-users@xmlgraphics.apache.org
cc
Subject
RE: How can I rotate text for a 90o sidebar?
Nice. I'll check this out.
-Lou
Rymasz Jacky
<jacky.rymasz@jc To:
fop-users@xmlgraphics.apache.org
decaux.fr> cc:
Subject: RE: How can I
rotate text for a 90o sidebar?
03/29/2005 03:39
Please respond
to fop-users
Here a bit of code which scatter each letter of a string into a vertical
set
of blocks (ie: vertical string):
<xsl:template name="scatter-string">
<xsl:param name="text"/>
<xsl:param name="rotated"/>
<xsl:variable name="len"><xsl:value-of
select="string-length($text)"/></xsl:variable>
<!-- Concat the blocks containing each letters -->
<xsl:value-of disable-output-escaping="yes"
select="$rotated"/>
<xsl:choose>
<xsl:when test="$len > 0">
<xsl:variable
name="vrotated">
<xsl:text
><fo:block></xsl:text>
<xsl:value-of
select="substring($text,1,1)"/>
<xsl:text
></fo:block></xsl:text>
</xsl:variable>
<xsl:call-template
name="scatter-string">
<xsl:with-param name="text">
<xsl:value-of
select="substring($text, 2)"/>
</xsl:with-param>
<xsl:with-param name="rotated">
<xsl:value-of
select="$vrotated"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
I hope this could help ;)
Jack
-----Message d'origine-----
De : Louis.Masters@log-net.com [mailto:Louis.Masters@log-net.com]
Envoyé : lundi 28 mars 2005 15:57
À : fop-users@xmlgraphics.apache.org
Objet : RE: How can I rotate text for a 90o sidebar?
The following code prints top to bottom, but the letters are stacked. It's
a starting point.
<svg:text x="1" y="1" writing-mode="tb" glyph-orientation-vertical="0">
YOUR
TEXT HERE </svg:text>
-Lou
"Andreas L.
Delmelle" To:
<fo...@xmlgraphics.apache.org>
<a_l.delmelle@pa cc:
ndora.be> Subject: RE: How can I
rotate
text for a 90o sidebar?
03/27/2005 06:30
Please respond
to fop-users
> -----Original Message-----
> From: Tommy Reynolds [mailto:Tommy.Reynolds@MegaCoder.com]
>
Hi,
> I'm trying to insert some text into "xsl-region-start" and I'd like it
> rotated 90-degrees to you'd have to tilt your head sideways to read
> it. I think the "reference-orientation"
> property is the right approach but it isn't implemented in FOP.
>
> Is there a work-around?
The only workaround I know of would be to use SVG to draw the rotated
text...
HTH!
Greetz,
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org