You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Phil Harling <ph...@db.com> on 2002/02/21 12:29:13 UTC

Re: getting the length in cm,mm or pt of a string

Nick Winger:
> is it possible to calculate, for a given font ( for example: arial ), the
> length of a string in cm, mm or pt
> ( the length which it will have in the pdf file content )



Yes.

1) Approximate it using the average width of a character in a font * 
string length.

2) Write a Java class and call it from an XSL transform passing in the 
string - and then calculate the length using the font classes/methods in 
FOP. Be careful of possible kerning.






---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: getting the length in cm,mm or pt of a string

Posted by Phil Harling <ph...@db.com>.
Nick Winger:

> What means 'kerning' exactly?



"Kerning" is adjusting the spacing between characters to make a word 
look nicer.  See http://partners.adobe.com/asn/developer/type/kerning.html.

Although you may not need to bother with calculating the kerning for the 
width of a string - it is usually very small - unless you need to be 
very precise.




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: getting the length in cm,mm or pt of a string

Posted by fred redf <po...@yahoo.fr>.
Hi all,

 --- Phil Harling <ph...@db.com> a écrit : >
Nick Winger:
> > is it possible to calculate, for a given font (
> for example: arial ), the
> > length of a string in cm, mm or pt
> > ( the length which it will have in the pdf file
> content )
> 
> 
> 
> Yes.
> 
> 1) Approximate it using the average width of a
> character in a font * 
> string length.
> 
> 2) Write a Java class and call it from an XSL
> transform passing in the 
> string - and then calculate the length using the
> font classes/methods in 
> FOP. Be careful of possible kerning.

What means 'kerning' exactly?


> 
> 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> fop-dev-unsubscribe@xml.apache.org
> For additional commands, email:
> fop-dev-help@xml.apache.org
>  

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org