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 robert frapples <oy...@gmail.com> on 2005/10/17 22:20:12 UTC

height of instream-foreign-object

I'm using instream-foriegn-objects and svg to attempt to have rotated text.
it seems that i cannot set the height of the instream-foreign-object any
smaller than whatever it decides to use, so my letters are all spaced out.
how can I get the instream-foreign-object to not be taller than its content?

<!-- this makes one letter -->
<xsl:template name="v">
<xsl:param name="text" select="''" />
<fo:instream-foreign-object height="0.05in">
<svg:svg height="6" width="9">
<svg:text x="4" y="0" writing-mode="tb"
width="1"
glpyh-orientation-vertical="0">
<xsl:value-of select="$text" />
</svg:text>
</svg:svg>
</fo:instream-foreign-object>
</xsl:template>

<!-- this puts one letter in a block -->
<xsl:template name="vletter">
<xsl:param name="letter" select="''" />
<fo:block padding="0" margin="0">
<xsl:call-template name="v">
<xsl:with-param name="text" select="$letter" />
</xsl:call-template>
</fo:block>
</xsl:template>

<!-- this calls itself recursively to call vletter for each charater in the
string -->
<xsl:template name="vtext">
<xsl:param name="text" select="''" />
<xsl:variable name="length">
<xsl:value-of select="string-length( $text )" />
</xsl:variable>
<xsl:if test="$length > 0">
<xsl:call-template name="vletter">
<xsl:with-param name="letter"
select="substring( $text, 1, 1 )" />
</xsl:call-template>
<xsl:call-template name="vtext">
<xsl:with-param name="text"
select="substring( $text, 2 )" />
</xsl:call-template>
</xsl:if>
</xsl:template>

Re: height of instream-foreign-object

Posted by JB...@s-s-t.com.
This sounds much like a problem I had some time back, wherein I needed to 
make a small-caps font without using an actual small-caps font. Recalling 
that a typographer friend once told me that the small caps is really an 
all caps font with the lower-case letters set to 5/8 the size of the 
upper-case letters, I wrote a recursive template in XSLT 1.0 to produce 
the desired effect. For that project, I was working in HTML, so I used 
span elements. I didn't want to use a span element for each character, so 
I grouped them by case (upper or lower).

I suspect you have an application that would benefit from something 
similar, with the i-f-o elements replacing the span elements.

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




Andreas L Delmelle <a_...@pandora.be> 
10/18/2005 11:15 AM
Please respond to
fop-users@xmlgraphics.apache.org


To
fop-users@xmlgraphics.apache.org
cc

Subject
Re: height of instream-foreign-object






On Oct 18, 2005, at 14:08, robert frapples wrote:

> On 10/17/05, Andreas L Delmelle <a_...@pandora.be> wrote:
>
>> The effect you get right now is that of a different block being
>> created for each i-f-o, the default height of which is always the
>> line-height (1.2em IIC). AFAICT, the only way to manipulate the
>> height would be to specify a different font-size/line-height for each
>> created block --but then again, this seems somewhat suboptimal. I
>> think you'll fare far better with putting all of the characters
>> inside one single instream-foreign-object.
>>
>
> I can't use a single instream-foreign-object because I have no idea
> how many letters there are, so I have no idea what the height should
> be. Using line-height="0.8em" is giving me good results though.

I see. Still, even if you don't know how many letters there will be, 
you can still use one instream-foreign-object. I'd even say that you 
*do* now the number of characters, since you start from a full string 
which you split into separate chars. All you'd need to do is 
determine the string-length and set content-height/block-progression- 
dimension accordingly.

FWIW... HTH!

Cheers,

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


Re: height of instream-foreign-object

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Oct 18, 2005, at 14:08, robert frapples wrote:

> On 10/17/05, Andreas L Delmelle <a_...@pandora.be> wrote:
>
>> The effect you get right now is that of a different block being
>> created for each i-f-o, the default height of which is always the
>> line-height (1.2em IIC). AFAICT, the only way to manipulate the
>> height would be to specify a different font-size/line-height for each
>> created block --but then again, this seems somewhat suboptimal. I
>> think you'll fare far better with putting all of the characters
>> inside one single instream-foreign-object.
>>
>
> I can't use a single instream-foreign-object because I have no idea
> how many letters there are, so I have no idea what the height should
> be. Using line-height="0.8em" is giving me good results though.

I see. Still, even if you don't know how many letters there will be,  
you can still use one instream-foreign-object. I'd even say that you  
*do* now the number of characters, since you start from a full string  
which you split into separate chars. All you'd need to do is  
determine the string-length and set content-height/block-progression- 
dimension accordingly.

FWIW... HTH!

Cheers,

Andreas

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


Re: height of instream-foreign-object

Posted by robert frapples <oy...@gmail.com>.
On 10/17/05, Andreas L Delmelle <a_...@pandora.be> wrote:
> I'm not sure I'm getting the point completely. Why do you insist on
> creating separate instream-foreign-objects for the different
> characters in the first place? IMO, the problem would practically
> solve itself if you could put all the text inside one i-f-o, no?
>
> The effect you get right now is that of a different block being
> created for each i-f-o, the default height of which is always the
> line-height (1.2em IIC). AFAICT, the only way to manipulate the
> height would be to specify a different font-size/line-height for each
> created block --but then again, this seems somewhat suboptimal. I
> think you'll fare far better with putting all of the characters
> inside one single instream-foreign-object.

I can't use a single instream-foreign-object because I have no idea
how many letters there are, so I have no idea what the height should
be. Using line-height="0.8em" is giving me good results though.

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


Re: height of instream-foreign-object

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Oct 17, 2005, at 22:20, robert frapples wrote:

Hi,

> I'm using instream-foriegn-objects and svg to attempt to have  
> rotated text. it seems that i cannot set the height of the instream- 
> foreign-object any smaller than whatever it decides to use, so my  
> letters are all spaced out. how can I get the instream-foreign- 
> object to not be taller than its content?

I'm not sure I'm getting the point completely. Why do you insist on  
creating separate instream-foreign-objects for the different  
characters in the first place? IMO, the problem would practically  
solve itself if you could put all the text inside one i-f-o, no?

The effect you get right now is that of a different block being  
created for each i-f-o, the default height of which is always the  
line-height (1.2em IIC). AFAICT, the only way to manipulate the  
height would be to specify a different font-size/line-height for each  
created block --but then again, this seems somewhat suboptimal. I  
think you'll fare far better with putting all of the characters  
inside one single instream-foreign-object.


HTH!

Andreas

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