![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Hello, (hope I do this right, first time try to write to a newsgroup)
I try to make a text in a povray picture, putting together characters in
different textures.( with the text object and a truetype fond)
I have problems setting the distance between the characters right, because I
do not know the exact width of the characters.
Have I to do this by try and error, translate the characters until it looks
right or can somebody think of another method to do this ?
Especially: Is there a method to get the exact width of a given character?
Jessica Bushnaq
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Jessica Bushnaq wrote:
>
> Hello, (hope I do this right, first time try to write to a newsgroup)
Welcome to these groups, the posting looks ok to me, some general
information about things here can be found in:
povray.announce.frequently-asked-questions
> I try to make a text in a povray picture, putting together characters in
> different textures.( with the text object and a truetype fond)
> I have problems setting the distance between the characters right, because I
> do not know the exact width of the characters.
> Have I to do this by try and error, translate the characters until it looks
> right or can somebody think of another method to do this ?
> Especially: Is there a method to get the exact width of a given character?
>
> Jessica Bushnaq
IIRC there is no method in Povray to find out the width of the single
characters. Some things you could do anyway:
- The character width is stored somewhere in the TTF file, you could try
to read it with an external program and put a table with the data of all
character in a pov-file
- You could use a non proportial font (like Courier), where all the
characters have the same width.
- you could try to find the gaps between the characters with megapov's
trace function and use a gradient pattern to give the different characters
different textures. This probably sounds quite complicated and it
requires some (pov-)programming knowledge, but IMO this is the most
elegant way :-)
Christoph
--
Christoph Hormann <chr### [at] gmx de>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
In article <3A17B933.82F38498@schunter.etc.tu-bs.de>,
chr### [at] gmx de wrote:
> - you could try to find the gaps between the characters with
> megapov's trace function and use a gradient pattern to give the
> different characters different textures. This probably sounds quite
> complicated and it requires some (pov-)programming knowledge, but IMO
> this is the most elegant way :-)
A more flexible(and far simpler) solution would be to use a separate
text object for every character and use the min_extent() and
max_extent() functions to get the bounding box for each individual
character, and use these values to position the characters correctly.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Chris Huff wrote:
>A more flexible(and far simpler) solution would be to use a separate
>text object for every character and use the min_extent() and
>max_extent() functions to get the bounding box for each individual
>character, and use these values to position the characters correctly.
>
Ron Parker made a macro for that:
Newsgroups: povray.programming
Subject: Re: Font metrics function
Message-ID: <slr### [at] parkerr fwi com>
Date: 27 Feb 2000 13:13:40 -0500
Ingo
--
Photography: http://members.home.nl/ingoogni/
Pov-Ray : http://members.home.nl/seed7/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Chris Huff wrote:
>
> A more flexible(and far simpler) solution would be to use a separate
> text object for every character and use the min_extent() and
> max_extent() functions to get the bounding box for each individual
> character, and use these values to position the characters correctly.
>
I think that's only partly true, because the nominal width of the
characters (used for positioning them) and the de facto with do not need
to be the same. I don't know which width is used for the bounding box
(whether all characters in a non proportional font have the same for
example), there can be even overlapping characters (they would not work
with the trace method either) so things are more complicated in fact...
Christoph
--
Christoph Hormann <chr### [at] gmx de>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sun, 19 Nov 2000 15:20:35 +0100, Christoph Hormann wrote:
>I think that's only partly true, because the nominal width of the
>characters (used for positioning them) and the de facto with do not need
>to be the same. I don't know which width is used for the bounding box
The difference is advance width and kerning. Those are taken into account
in the macro Ingo made note of.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Jessica Bushnaq wrote:
>
> Especially: Is there a method to get the exact width of a given
> character?
I have only the official version, and here's the code I use to get the
width of text:
// START OF SOMETHING OF POSSIBLE USE
#local W=1; // you'll be tweaking this value
text { ttf "cyrvetic.ttf", // or whatever font you're using
"My text.", // change to whatever you're using
0,
0
pigment { rgb <1,0,0> } // to make things obvious
finish { ambient 1 diffuse 0 }
translate -z*.001
}
plane { -z,0
pigment { gradient x color_map { [0 rgb 0][1 rgb 1] } scale W }
finish { ambient 1 diffuse 0 }
}
camera {
orthographic
location <W,.375,-1>
look_at <W,.375,0>
}
// END OF SOMETHING OF POSSIBLE USE
You should see an image that is white on the left side and black on
the right, with red text. Adjust W until the right edge of the text
lies exactly on the border between the black and white areas. When
this happens, W is either the exact width of the text, or is a simple
fraction (1/2, 1/3, 1/4) of that width; starting with a higher value
and working your way down will give better results.
Hope this helps,
John
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
John VanSickle wrote:
>You should see an image that is white on the left side and black on
>the right, with red text. Adjust W until the right edge of the text
>lies exactly on the border between the black and white areas. When
>this happens, W is either the exact width of the text, or is a simple
>fraction (1/2, 1/3, 1/4) of that width; starting with a higher value
>and working your way down will give better results.
This makes me think, if your intention is to put the letters on the same
positions as they are in the "full text", you could as well use a
pigment_map or texture_map with a gradient to give each letter a different
texture.
text {
ttf
"crystal.ttf",
"POV",
0.1,
0
pigment {
gradient x
scale 2
pigment_map{
[0.2, wood]
[0.2, granite]
[0.5, granite]
[0.5, wood]
}
}
translate <-0.75,0,0>
}
Ingo
--
Photography: http://members.home.nl/ingoogni/
Pov-Ray : http://members.home.nl/seed7/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Chris Huff wrote:
> A more flexible(and far simpler) solution would be to use a separate
> text object for every character and use the min_extent() and
> max_extent() functions to get the bounding box for each individual
> character, and use these values to position the characters correctly.
I'm trying to get a text string centered, and I remembered this thread.
Chris, can I use min_extent() and max_extent() on a string, or is it
only applicable to single characters? Where can I find documentation on
these functions; it doesn't seem to be with the other text primitive
documentation in the official docs.
For that matter, if the function is not part of POV natively, where can
I find the function?
Thanks in advance.
--
Dawn McKnight | "Who cares what the hipbone's connected to? I'm in Neurology!"
McK### [at] mac com | -- Justine Devlin, M.D.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Tue, 21 Nov 2000 21:16:03 -0700, Dawn McKnight wrote:
>I'm trying to get a text string centered, and I remembered this thread.
>Chris, can I use min_extent() and max_extent() on a string, or is it
>only applicable to single characters?
It will work with almost any finite primitive, which includes a multicharacter
text object. It fails on some CSGs, though; most notably on intersections and
differences.
>For that matter, if the function is not part of POV natively, where can
>I find the function?
It's part of MegaPOV and other patches like it.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |