POV-Ray : Newsgroups : povray.advanced-users : width of a ttf object Server Time
31 Oct 2024 19:24:54 EDT (-0400)
  width of a ttf object (Message 1 to 4 of 4)  
From: Anton Sherwood
Subject: width of a ttf object
Date: 22 Jan 2014 18:43:52
Message: <52e057b8$1@news.povray.org>
I have a scene concept involving centred text, and I want to try it with 
many different fonts (using a Python program to write the .pov files). 
Is there a way to center text without measuring its width by eye, every 
time?  Perhaps a function that returns the dimensions of a bounding box?

-- 
*\\* Anton Sherwood *\\* www.bendwavy.org


Post a reply to this message

From: clipka
Subject: Re: width of a ttf object
Date: 22 Jan 2014 19:25:48
Message: <52e0618c$1@news.povray.org>
Am 23.01.2014 00:43, schrieb Anton Sherwood:
> I have a scene concept involving centred text, and I want to try it with
> many different fonts (using a Python program to write the .pov files).
> Is there a way to center text without measuring its width by eye, every
> time?  Perhaps a function that returns the dimensions of a bounding box?

Not exactly, but the functions min_extent(MyObj) and max_extent(MyObj) 
do indeed return the "lowest" and "highest" corner, respectively, of the 
bounding box, so the following line should do the job:

#local Width = (max_extent(MyTextObj)-min_extent(MyTextObj)).x;


Post a reply to this message

From: Anton Sherwood
Subject: Re: width of a ttf object
Date: 22 Jan 2014 22:50:58
Message: <52e091a2$1@news.povray.org>
On 2014-1-22 16:25, clipka wrote:
> #local Width = (max_extent(MyTextObj)-min_extent(MyTextObj)).x;

Thank you, that works perfectly.

-- 
*\\* Anton Sherwood *\\* www.bendwavy.org


Post a reply to this message

From: Christian Froeschlin
Subject: Re: width of a ttf object
Date: 23 Jan 2014 19:25:23
Message: <52e1b2f3$1@news.povray.org>
On 23.01.2014 0:43, Anton Sherwood wrote:

> I have a scene concept involving centred text, and I want to try it with
> many different fonts (using a Python program to write the .pov files).

Note you can also just write out an array of font names you want to
try and setup a pov script to render all images as an animation. Might
be more convenient, especially when changing the pov code later.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.