POV-Ray : Newsgroups : povray.general : Center of Text-object Server Time
31 Oct 2024 08:17:44 EDT (-0400)
  Center of Text-object (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: iceqb
Subject: Center of Text-object
Date: 1 Dec 2005 07:45:00
Message: <web.438eef86e7afde9b4426fcbb0@news.povray.org>
I'm currently working on a scene which contains stacks of wooden word-blocks
(you know, those blocks that have letters engraved in them). To easily
produce these blocks I wrote a macro, that requires the letter and a color.
Now I was wondering how I could determine the center or size of the font
object so I can position it correctly. Because now with non-monospaced
fonts the letters are not correctly centered in front of the block.

thanks in advance!


Post a reply to this message

From: Warp
Subject: Re: Center of Text-object
Date: 1 Dec 2005 08:16:55
Message: <438ef7c7@news.povray.org>
iceqb <nomail@nomail> wrote:
> Now I was wondering how I could determine the center or size of the font
> object so I can position it correctly.

  min_extent() and max_extent()

-- 
                                                          - Warp


Post a reply to this message

From: iceqb
Subject: Re: Center of Text-object
Date: 1 Dec 2005 11:45:01
Message: <web.438f28856a36f83a4426fcbb0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:

>   min_extent() and max_extent()

Didn't think about that, but then I would have to declare the letter before
using it in the difference, i don't suppose there's a way to do it in the
text {..} block?


Post a reply to this message

From: Warp
Subject: Re: Center of Text-object
Date: 1 Dec 2005 11:56:45
Message: <438f2b4d@news.povray.org>
iceqb <nomail@nomail> wrote:
> Didn't think about that, but then I would have to declare the letter before
> using it in the difference

  Correct.

-- 
                                                          - Warp


Post a reply to this message

From: Mike Williams
Subject: Re: Center of Text-object
Date: 1 Dec 2005 12:06:53
Message: <zlL$mHAdzyjDFwqw@econym.demon.co.uk>
Wasn't it iceqb who wrote:
>Warp <war### [at] tagpovrayorg> wrote:
>
>>   min_extent() and max_extent()
>
>Didn't think about that, but then I would have to declare the letter before
>using it in the difference, i don't suppose there's a way to do it in the
>text {..} block?

Not in official POV, but there are h_align_center and v_align_center
keywords in MegaPOV.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Warp
Subject: Re: Center of Text-object
Date: 1 Dec 2005 12:18:24
Message: <438f305f@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Not in official POV, but there are h_align_center and v_align_center
> keywords in MegaPOV.

  Aren't they kind of obsolete? It isn't much more difficult to do the
same with the extents functions.

-- 
                                                          - Warp


Post a reply to this message

From: Mike Williams
Subject: Re: Center of Text-object
Date: 1 Dec 2005 12:28:51
Message: <LkDhmNA9JzjDFw9F@econym.demon.co.uk>
Wasn't it Warp who wrote:
>Mike Williams <nos### [at] econymdemoncouk> wrote:
>> Not in official POV, but there are h_align_center and v_align_center
>> keywords in MegaPOV.
>
>  Aren't they kind of obsolete? It isn't much more difficult to do the
>same with the extents functions.

The extents functions were there first, but the MegaPOV text alignment
options keep getting reinvented. Over time MegaPOV has had "position 2"
and "align_center" syntax for text centring as well as the current
"h_align_center"/"v_align_center" syntax. I guess some people feel that
there's a need for it.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: John VanSickle
Subject: Re: Center of Text-object
Date: 1 Dec 2005 22:10:40
Message: <438fbb30$1@news.povray.org>
iceqb wrote:

> Warp <war### [at] tagpovrayorg> wrote:
> 
> 
>>  min_extent() and max_extent()
> 
> 
> Didn't think about that, but then I would have to declare the letter before
> using it in the difference, i don't suppose there's a way to do it in the
> text {..} block?

Try this:

#local txtL=text { ttf FontName, "A",1,0 }

object { txtL
   translate -(min_extent(txtL)+max_extent(txtL))/2
}

Regards,
John


Post a reply to this message

From: iceqb
Subject: Re: Center of Text-object
Date: 2 Dec 2005 05:50:01
Message: <web.439026716a36f83a4426fcbb0@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Not in official POV, but there are h_align_center and v_align_center
> keywords in MegaPOV.

Are these special text functions still in MegaPOV 1.2.1, I didn't know.
Thanks for the advice!


Post a reply to this message

From: Mike Williams
Subject: Re: Center of Text-object
Date: 2 Dec 2005 06:29:09
Message: <7FK9+DAE6CkDFwxx@econym.demon.co.uk>
Wasn't it iceqb who wrote:
>Mike Williams <nos### [at] econymdemoncouk> wrote:
>> Not in official POV, but there are h_align_center and v_align_center
>> keywords in MegaPOV.
>
>Are these special text functions still in MegaPOV 1.2.1, I didn't know.
>Thanks for the advice!

They're in 1.2, I've not checked 1.2.1 but it's very unlikely that
functions would get deleted from a minor level change.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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