POV-Ray : Newsgroups : povray.general : text with background Server Time
24 Nov 2024 08:27:16 EST (-0500)
  text with background (Message 1 to 4 of 4)  
From: Kima
Subject: text with background
Date: 4 Aug 2019 15:05:00
Message: <web.5d472b3237fd6e25ecc0fada0@news.povray.org>
I know I can put a text object on a geometrical shape by techniques such as
"difference", but in this case, I need to know the width of the text to create
an object with the same size?

How can I set a background for a text object when I don't know the width/length
of the text?


Post a reply to this message

From: William F Pokorny
Subject: Re: text with background
Date: 5 Aug 2019 07:09:04
Message: <5d480e50$1@news.povray.org>
On 8/4/19 3:00 PM, Kima wrote:
> I know I can put a text object on a geometrical shape by techniques such as
> "difference", but in this case, I need to know the width of the text to create
> an object with the same size?
> 
> How can I set a background for a text object when I don't know the width/length
> of the text?
> 
Hi. There are min_extent(), max_extent() object bounding box commands.

For what you are doing though, the object pattern using your text as the 
object is perhaps easier. See the shipped sample scene

<install dir>/scene/advanced/object_pattern.pov

or the more interesting abyss.pov where the PERSISTENCE text is written 
on the submarine (not perfectly aligned) using the object pattern.

You can find the most current sample scenes online at:

https://github.com/POV-Ray/povray/distribution.

Bill P.


Post a reply to this message

From: Alain
Subject: Re: text with background
Date: 5 Aug 2019 12:33:30
Message: <5d485a5a$1@news.povray.org>
Le 19-08-04 à 15:00, Kima a écrit :
> I know I can put a text object on a geometrical shape by techniques such as
> "difference", but in this case, I need to know the width of the text to create
> an object with the same size?
> 
> How can I set a background for a text object when I don't know the width/length
> of the text?
> 
> 
> 

I By using min_extent(), max_extent(), you'll get the extent of your 
text object.

In fact, you only need to use max_extent(TextObject).x in the present 
context as text objects start at x=0 and build top the right, or +x 
direction.

(max_extent(TextObject).y - min_extent(TextObject).y) will return the 
height. Using min_extent is needed to take into account the descender of 
some letters :«y», «q», «j» and «g».


Post a reply to this message

From: Bald Eagle
Subject: Re: text with background
Date: 5 Aug 2019 13:45:06
Message: <web.5d486a40a6d63a3a4eec112d0@news.povray.org>
Just throwing this reference ink in in case some of these directives may help
with anything else you're doing.

http://wiki.povray.org/content/Reference:Strings

It's often helpful to make a second object {} or transparent box or a wire box
(shapes2.inc) as a marker or placeholder when you're doing differences, since
all of the things you're differencing from the parent object don't show up....

Just in case that saves you some headaches...


Post a reply to this message

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