 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I started looking at a yuqk version of documentation for the text{}
object. I quickly found out I've been decades clueless about the offset
vector; Always setting the value to 0 - or maybe 0.1*x, if I wanted a
little extra space between characters.
Well, we can already do vertical and right to left text so long as it is
a mono-space font. I've long thought this a missing feature in POV-Ray.
For example:
text {
ttf "/home/pokorny/Fonts/LiberationMono-Regular.ttf"
"What the heck?",
1.0, <-0.6,-1.0,0>
pigment { rgb <.7,.3,.1> }
finish { emission 1 }
translate <-0.3,5.75,0>
scale 0.1
}
text {
ttf "/home/pokorny/Fonts/LiberationMono-Regular.ttf"
"Backwards",
1.0, <-1.3,0,0>
pigment { rgb <.7,.3,.1> }
finish { emission 1 }
translate <+2.6,8.0,0>
scale 0.1
}
Only tricky part is figuring out the base character size and spacing.
I've not found an easy and reliable way to do that as yet. I got to the
above values by trial and error.
Used box characters for the rectangular frame using the strings:
"┌─────────┐", "└─────────┘" and
"│││││││││││││││",
Bill P.
Post a reply to this message
Attachments:
Download 'textoffsetsstory.png' (48 KB)
Preview of image 'textoffsetsstory.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
William F Pokorny <ano### [at] anonymous org> wrote:
> I quickly found out I've been decades clueless about the offset
> vector; Always setting the value to 0 - or maybe 0.1*x, if I wanted a
> little extra space between characters.
I.i.r.c. Ron Parker has once posted a macro for "kerning"(?), can't find it any
more.
ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
William F Pokorny <ano### [at] anonymous org> wrote:
> I started looking at a yuqk version of documentation for the text{}
> object. I quickly found out I've been decades clueless about the offset
> vector; Always setting the value to 0 - or maybe 0.1*x, if I wanted a
> little extra space between characters.
You and me both.
I don't even use a "vector" - I always set it to 0.
So I'm invisibly using <0, 0, 0>
Perhaps the docs can be edited to give a slightly better example.
Docs:
The horizontal spacing is handled by POV-Ray internally including any kerning
information stored in the font. The required vector <Offset> defines any extra
translation between each character. Normally you should specify a zero for this
value. Specifying 0.1*x would put additional 0.1 units of space between each
character. Here is an example:
text {
ttf "timrom.ttf" "POV-Ray" 1, 0
pigment { Red }
}
Also, I'll probably want tiny example scene that better/best demonstrates
whatever else it is that you discover in playing with this heretofore ignored
feature.
Thanks!
- BW
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Jörg "Yadgar" Bleimann
Subject: Re: Other things the text object can do.
Date: 4 Mar 2025 15:24:58
Message: <67c7619a$1@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Banzai!
On 04.03.25 16:35, William F Pokorny wrote:
> I started looking at a yuqk version of documentation for the text{}
> object. I quickly found out I've been decades clueless about the offset
> vector; Always setting the value to 0 - or maybe 0.1*x, if I wanted a
> little extra space between characters.
>
> Well, we can already do vertical and right to left text so long as it is
> a mono-space font. I've long thought this a missing feature in POV-Ray.
> For example:
>
> text {
> ttf "/home/pokorny/Fonts/LiberationMono-Regular.ttf"
> "What the heck?",
> 1.0, <-0.6,-1.0,0>
> pigment { rgb <.7,.3,.1> }
> finish { emission 1 }
> translate <-0.3,5.75,0>
> scale 0.1
> }
Kawaii!
Sayonara,
Yadugaru
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
William F Pokorny <ano### [at] anonymous org> wrote:
>
> Only tricky part is figuring out the base character size and spacing.
> I've not found an easy and reliable way to do that as yet. I got to the
> above values by trial and error.
>
> Used box characters for the rectangular frame using the strings:
> "┌─────────┐",
"└────
─────┘" and
"││││││││││
│││││",
>
> Bill P.
If you are using a mono-type font, this worked for me:
#local _t1 = text { ttf "fontname.ttf" "A" 1.0, 0 }
#local _t2 = text { ttf "fontname.ttf" "AA" 1.0, 0 }
#local _t1sz = max_extent(_t1) - min_extent(_t1);
#local _t2sz = max_extent(_t2) - min_extent(_t2);
#local _unit_width = (_t2sz - _t1sz).x;
text { ttf "fontname.ttf" "What the heck?" 1.0, -2*unit_width*x }
text { ttf "fontname.ttf" "What the heck?" 1.0, <-unit_width, -1, 0> translate
<0, 14, 0> }
-- Chris R
Post a reply to this message
Attachments:
Download 'text_test.png' (155 KB)
Preview of image 'text_test.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/4/25 15:24, Jörg "Yadgar" Bleimann wrote:
> Banzai!
>
...
>
> Kawaii!
>
> Sayonara,
>
> Yadugaru
>
:-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/5/25 09:11, Chris R wrote:
> If you are using a mono-type font, this worked for me:
>
> #local _t1 = text { ttf "fontname.ttf" "A" 1.0, 0 }
> #local _t2 = text { ttf "fontname.ttf" "AA" 1.0, 0 }
> #local _t1sz = max_extent(_t1) - min_extent(_t1);
> #local _t2sz = max_extent(_t2) - min_extent(_t2);
> #local _unit_width = (_t2sz - _t1sz).x;
Thank you Chris!
This approach is working for me with the couple of mono-space fonts just
tried.
Along with using the height of the vertical box character for the unit
height.
Bill P.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"ingo" <nomail@nomail> wrote:
> I.i.r.c. Ron Parker has once posted a macro for "kerning"(?), can't find it any
> more.
>
This post references the macro, but still can't find it:
https://news.povray.org/povray.general/message/%3Cslrn90m9mi.23r.ron.parker%40fwi.com%3E/#%3Cslrn90m9mi.23r.ron.parker%
40fwi.com%3E
ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"ingo" <nomail@nomail> wrote:
> "ingo" <nomail@nomail> wrote:
>
> > I.i.r.c. Ron Parker has once posted a macro for "kerning"(?), can't find it any
> > more.
> >
>
> This post references the macro, but still can't find it:
>
>
https://news.povray.org/povray.general/message/%3Cslrn90m9mi.23r.ron.parker%40fwi.com%3E/#%3Cslrn90m9mi.23r.ron.parke
r%
> 40fwi.com%3E
>
> ingo
It looks like it might not be on the (current) server anymore.
Which means that this is either a job for TdG or Chris Cason ...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Chris R" <car### [at] comcast net> wrote:
> William F Pokorny <ano### [at] anonymous org> wrote:
> >
> > Only tricky part is figuring out the base character size and spacing.
> > I've not found an easy and reliable way to do that as yet. I got to the
> > above values by trial and error.
> >
> > Used box characters for the rectangular frame using the strings:
> > "┌─────────┐",
"└───γ
2;
> ─────┘" and
"│││││││││γ
4;
> │││││",
> >
> > Bill P.
>
> If you are using a mono-type font, this worked for me:
>
> #local _t1 = text { ttf "fontname.ttf" "A" 1.0, 0 }
> #local _t2 = text { ttf "fontname.ttf" "AA" 1.0, 0 }
> #local _t1sz = max_extent(_t1) - min_extent(_t1);
> #local _t2sz = max_extent(_t2) - min_extent(_t2);
> #local _unit_width = (_t2sz - _t1sz).x;
>
> text { ttf "fontname.ttf" "What the heck?" 1.0, -2*unit_width*x }
> text { ttf "fontname.ttf" "What the heck?" 1.0, <-unit_width, -1, 0> translate
> <0, 14, 0> }
>
> -- Chris R
I remember this little trick. But I didn't want to be limited to mono-type
fonts so I wrote a macro that cut a string into pieces and place each letter
separately. And promptly forgot about it.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |