POV-Ray : Newsgroups : povray.binaries.images : Other things the text object can do. Server Time
14 Mar 2025 09:34:56 EDT (-0400)
  Other things the text object can do. (Message 1 to 10 of 29)  
Goto Latest 10 Messages Next 10 Messages >>>
From: William F Pokorny
Subject: Other things the text object can do.
Date: 4 Mar 2025 10:35:58
Message: <67c71dde$1@news.povray.org>
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'
textoffsetsstory.png


 

From: ingo
Subject: Re: Other things the text object can do.
Date: 4 Mar 2025 11:00:00
Message: <web.67c722ec9216b80b17bac71e8ffb8ce3@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> 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

From: Bald Eagle
Subject: Re: Other things the text object can do.
Date: 4 Mar 2025 11:05:00
Message: <web.67c724159216b80b6563700825979125@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> 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

From: Chris R
Subject: Re: Other things the text object can do.
Date: 5 Mar 2025 09:15:00
Message: <web.67c85b769216b80b33dbb0635cc1b6e@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> 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'
text_test.png


 

From: William F Pokorny
Subject: Re: Other things the text object can do.
Date: 5 Mar 2025 11:26:06
Message: <67c87b1e$1@news.povray.org>
On 3/4/25 15:24, Jörg "Yadgar" Bleimann wrote:
> Banzai!
> 
...
> 
> Kawaii!
> 
> Sayonara,
> 
> Yadugaru
> 

:-)


Post a reply to this message

From: William F Pokorny
Subject: Re: Other things the text object can do.
Date: 5 Mar 2025 11:31:07
Message: <67c87c4b$1@news.povray.org>
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

From: ingo
Subject: Re: Other things the text object can do.
Date: 5 Mar 2025 11:45:00
Message: <web.67c87f1b9216b80b17bac71e8ffb8ce3@news.povray.org>
"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

From: Bald Eagle
Subject: Re: Other things the text object can do.
Date: 5 Mar 2025 14:25:00
Message: <web.67c8a4779216b80b3018e75b25979125@news.povray.org>
"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

From: Leroy
Subject: Re: Other things the text object can do.
Date: 5 Mar 2025 18:40:00
Message: <web.67c8df239216b80b89cd8458f712fc00@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
> William F Pokorny <ano### [at] anonymousorg> 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:
> > "┌─────────┐",
"└───&#947
2;
> ─────┘" and
"│││││││││&#947
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

Goto Latest 10 Messages Next 10 Messages >>>

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