|
![](/i/fill.gif) |
Thomas Lehmann <tle### [at] iez com> wrote:
: is there any way to center a text of any font in a
: bounding box ?
Yes, using MegaPov.
http://nathan.kopp.com/patched.htm
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <391169D5.9C54F7F9@iez.com>, Thomas Lehmann
<tle### [at] iez com> wrote:
>Hi,
>
>is there any way to center a text of any font in a
>bounding box ?
You need to use megapov, basically. There are two ways of doing it.
1. The font can be centered on itself. I believe this is only left-right
centering, but then the center of the image is at x=0 and you can move
it where you want. I think you simply add the keyword 'center', but
check the docs.
2. If you want to center verticaly as well as horizontally, the megapov
includes Ron Parker's "Object Bounds" which gives you the bounding box
of an object. Create your text object and assign it to a variable:
myText = text { .... }
myTextMin = min_extent(myText);
myTextMax = max_extent(myText);
object { myText
translate <(myTextMax.x-myTextMin.x)/2,
(myTextMax.y-myTextMin.y)/2,
0>
}
should center your object vertically and horizontally. From there, you
can move it where you need it. You can also use the extents to scale
your text object to a specific height and/or width, so as to fit exactly
inside a desired object.
Jerry
Post a reply to this message
|
![](/i/fill.gif) |