|
|
Also, if you are using 3.5 you can centre the text better and automatically
using the min_extents/max_extents keyword.
Here's a macro I wrote a while ago to fit text to a certain area (scales the
text as well):
-----8<-----
//p1-p2 define box containing text
//FNam = font name
//Txt = text string
//Spac = letter spacing
#macro TxtFit(p1,p2,FNam,Txt,Spac)
#local T1=text{ttf FNam, Txt, 1,Spac*x}
#local TMn = min_extent (T1);
#local TMx = max_extent (T1);
#local TScal=(p2-p1)/(TMx-TMn);
object{T1 translate -TMn scale TScal translate p1}
#end
-----8<-----
used like:
object{TxtFit(<-1,-1,0>,<2,1,1>,"arial","If the text fits...",0)
//extra transformations, materials, etc.
}
this fits the given text between the two points along the x-y plane. You
can then rotate the text or translate as needed to suit.
-tgq
Post a reply to this message
|
|