Hi Pascal,

it's me again.

>That is your job! And you did it!

Bad job! It doesn't work.  :-|


>$width_unit and $height_unit should be =< your cell content size, including
unit.

This part seems OK.


>$max_x and $max_y depend on the text nested in svg snippet.

That's the point.


>You can make it dependant on text length and font-size if needed.

What's the correlation between the two values ($max_x, $max_y), the text
length and the font size?
Could you give as an example, please? Did you try it yourself?


Thanks for your help!
Rainer

 

-----Ursprüngliche Nachricht-----
Von: Pascal Sancho [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 18. Mai 2006 14:32
An: fop-users@xmlgraphics.apache.org
Betreff: RE: Scaling of Text

> -----Original Message-----
> From: Kring, Rainer [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 18, 2006 12:56 PM
> 
> Hi Pascal,
> 
> how do you know the values for $width_unit, $height_unit and 
> especially $max_x, $max_y. Could please give me an example?

That is your job! And you did it!

$width_unit and $height_unit should be =< your cell content size, including
unit.
$max_x and $max_y depend on the text nested in svg snippet.
You can make it dependant on text length and font-size if needed.

Pascal

> Here is what we tried:
> 
> <fo:table-row height="94.0pt">
> <fo:table-cell>
> </fo:table-cell>
> <fo:table-cell border-bottom-style="solid" border-bottom-width="1.0pt"
> border-left-style="solid" border-left-width="1.0pt"
> border-right-style="solid" border-right-width="1.0pt"
> border-top-style="solid" border-top-width="1.0pt" text-align="center"
> display-align="before">
> <fo:block white-space-collapse="true" text-align="center" 
> color="#ff0000"
> font-family="Kerstin1" font-size="10.0pt">
> 
> <fo:instream-foreign-object width="238pt" height="94.0pt"
> xmlns="http://www.w3.org/2000/svg";>
>       <svg width="238pt" height="94.0pt" 
> preserveAspectRatio="xMidYMid meet" viewBox="0 0 238 94>
>               <text x="0" y="10.0pt" ><xsl:value-of
disable-output-escaping="no" 
> select="price_outlet_entire"/></text>
>       </svg>
> </fo:instream-foreign-object>
>  
> -----Ursprüngliche Nachricht-----
> Von: Pascal Sancho [mailto:[EMAIL PROTECTED]
> 
> As a workaround, you can use svg, witch allows to scale content, using
> preserveAspectRatio:
> 
> <fo:instream-foreign-object width="{$width_unit}" 
> height="{$height_unit}"
> xmlns="http://www.w3.org/2000/svg";>
>       <svg width="{$width_unit}" height="{$height_unit}"
> preserveAspectRatio="xMidYMid meet" viewBox="0 0 {$max_x} {$max_y}">
>               <text x="0" y="{$font_size}"
> text-anchor="{$alignement}">your text here</text>
>       </svg>
> </fo:instream-foreign-object>
> 
> > -----Original Message-----
> > From: Kring, Rainer [mailto:[EMAIL PROTECTED]
>  
> > thanks for the quick answer.
> > 
> > I think you got me wrong. We don't want to cut or wrap the
> string. We
> > have to resize the font. The font-size must be altered to fit the 
> > string into the cell, so that the the string is neither bigger nor 
> > smaller then the cell.
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Jimmy Dixon [mailto:[EMAIL PROTECTED]
> > 
> > this is a nasty one - basically the answer is no, if the
> value of the
> > table cell is text the best you can do is to insert non breaking 
> > spaces between the letters t ensure it wraps and doesnt overflow.
> > 
> > this template does the trick:
> > 
> > <xsl:template name="zero-length-spaces">
> >     <xsl:param name="string"/>
> >     <xsl:param name="len" select="string-length($string)"/>
> >     <xsl:choose>
> >         <xsl:when test="$len = 1">
> >             <xsl:value-of
> > select="$string"/><xsl:text>&#x200B;</xsl:text>
> >         </xsl:when>
> >         <xsl:when test="$len = 0">
> >             <xsl:text>-</xsl:text>
> >         </xsl:when>
> >         <xsl:otherwise>
> >             <xsl:call-template name="zero-length-spaces">
> >                 <xsl:with-param name="string" 
> > select="substring($string,1,floor($len div 2))"/>
> >                 <xsl:with-param name="len" select="floor($len div 
> > 2)"/>
> >             </xsl:call-template>
> >             <xsl:call-template name="zero-length-spaces">
> >                 <xsl:with-param name="string" 
> > select="substring($string,floor($len div 2) + 1)"/>
> >                 <xsl:with-param name="len" 
> > select="ceiling($len div 2)"/>
> >             </xsl:call-template>
> >         </xsl:otherwise>
> >     </xsl:choose>
> > </xsl:template>
> > 
> > Kring, Rainer wrote:
> > 
> > >We have a table-cell with a certain size defined by
> column-width and
> > >table-row height (example below). Now we want to scale the
> > xsl:value-of
> > >output to maximum size of the cell. Is there any chances
> to get this
> > >done with FOP 0.20.5?
> > >
> > >
> > ><fo:table-column column-width="238pt"/>
> > >
> > >
> > ><fo:table-row height="94.0pt">
> > ><fo:table-cell>
> > ></fo:table-cell>
> > ><fo:table-cell border-bottom-style="solid" 
> > border-bottom-width="1.0pt"
> > >border-left-style="solid" border-left-width="1.0pt"
> > >border-right-style="solid" border-right-width="1.0pt"
> > >border-top-style="solid" border-top-width="1.0pt" 
> text-align="center"
> > >display-align="before">
> > ><fo:block white-space-collapse="true"  text-align="center" 
> > color="#ff0000"
> > >font-family="Kerstin1" font-size="12.0pt"> <xsl:value-of 
> > >disable-output-escaping="no" select="price_outlet_entire"/>
> > </fo:block>
> > ></fo:table-cell> <fo:table-cell> </fo:table-cell> </fo:table-row>


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

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

Reply via email to