POV-Ray : Newsgroups : povray.binaries.images : Other things the text object can do. Server Time
14 Mar 2025 08:29:39 EDT (-0400)
  Other things the text object can do. (Message 20 to 29 of 29)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: ingo
Subject: Re: Other things the text object can do.
Date: 6 Mar 2025 13:50:00
Message: <web.67c9ed999216b80b17bac71e8ffb8ce3@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote

>
https://news.povray.org/povray.beta-test/thread/%3C3bd48bf6%40news.povray.org%3E/?ttop=441402&toff=1900

The explanation in the last post of this thread is the interesting bit. Last
post:
https://news.povray.org/povray.beta-test/message/%3Cslrn9tdjuv.32q.ron.parker%40fwi.com%3E/#%3Cslrn9tdjuv.32q.ron.parke
r%40fwi.com%3E

ingo


Post a reply to this message

From: Chris R
Subject: Re: Other things the text object can do.
Date: 6 Mar 2025 14:55:00
Message: <web.67c9fcb19216b80b33dbb0635cc1b6e@news.povray.org>
"Leroy" <whe### [at] gmailcom> wrote:
> "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:
> > > "┌─────────┐",
"└───&#9
47
> 2;
> > ─────┘" and
"│││││││││&#9
47
> 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.

Aah!  In the meantime, I went down a rabbit hole and essentially did the same
thing...

See: https://github.com/carath63/povlibrary
library/libtext.inc
Examples/text_test.pov

Here is an example of using that technique to lay out text around a cylinder, up
a helix, and following a spline.  The spline relies on how close your the
distance between letters lines up with the distance between spline points.  As
you can see, it didn't work very well once the letters moved around the front
curve of the spline.  Still trying to figure out how to fix that.

-- Chris R


Post a reply to this message


Attachments:
Download 'text_test.png' (98 KB)

Preview of image 'text_test.png'
text_test.png


 

From: Chris R
Subject: Re: Other things the text object can do.
Date: 6 Mar 2025 15:35:00
Message: <web.67ca06699216b80b33dbb0635cc1b6e@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
> "Leroy" <whe### [at] gmailcom> wrote:
> > "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:
> > > >
"┌─────────┐",
"└───&
#9
> 47
> > 2;
> > > ─────┘" and
"│││││││││&
#9
> 47
> > 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.
>
> Aah!  In the meantime, I went down a rabbit hole and essentially did the same
> thing...
>
> See: https://github.com/carath63/povlibrary
> library/libtext.inc
> Examples/text_test.pov
>
> Here is an example of using that technique to lay out text around a cylinder, up
> a helix, and following a spline.  The spline relies on how close your the
> distance between letters lines up with the distance between spline points.  As
> you can see, it didn't work very well once the letters moved around the front
> curve of the spline.  Still trying to figure out how to fix that.
>
> -- Chris R

To prove my spline layout code is correct, I created some tools for converting a
spline whose values have an arbitrary range into a spline whose values go from
0.0 to the computed length of the spline over the given range of values.  Using
a spline that has been tuned this way gave a much better result in laying out
the text.

-- Chris R


Post a reply to this message


Attachments:
Download 'text_test.png' (85 KB)

Preview of image 'text_test.png'
text_test.png


 

From: Bald Eagle
Subject: Re: Other things the text object can do.
Date: 6 Mar 2025 16:00:00
Message: <web.67ca0bc19216b80bd97b426e25979125@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:

> To prove my spline layout code is correct, I created some tools for converting a
> spline whose values have an arbitrary range into a spline whose values go from
> 0.0 to the computed length of the spline over the given range of values.  Using
> a spline that has been tuned this way gave a much better result in laying out
> the text.

are you aware that there are spline macros to do this sort of thing?
IIRC, they are in transforms.inc

- BW


Post a reply to this message

From: Chris R
Subject: Re: Other things the text object can do.
Date: 7 Mar 2025 11:10:00
Message: <web.67cb194b9216b80b53fb81ab5cc1b6e@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Chris R" <car### [at] comcastnet> wrote:
>
> > To prove my spline layout code is correct, I created some tools for converting a
> > spline whose values have an arbitrary range into a spline whose values go from
> > 0.0 to the computed length of the spline over the given range of values.  Using
> > a spline that has been tuned this way gave a much better result in laying out
> > the text.
>
> are you aware that there are spline macros to do this sort of thing?
> IIRC, they are in transforms.inc
>
> - BW

I knew in the back of my head that I had used the Spline_Trans macro before, but
couldn't remember what it was called or where it was.  Thanks!

I'll probably create a new version of my Text Spline alignment macro and replace
my code for computing the rotations with this, which allow for banking the text
as well, which would be cool.

The macro still has to do the work of computing the offset based on the letter
spacing, and then using this macro to do the placement and orientation.  And I
haven't seen anything equivalent to the code I wrote to convert a Spline using
arbitrary values with a Spline that uses distances along the spline curve for
values, so I think that's still useful.

-- Chris R


Post a reply to this message

From: Bald Eagle
Subject: Re: Other things the text object can do.
Date: 7 Mar 2025 11:55:00
Message: <web.67cb24049216b80ba5a6be6925979125@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:

> The macro still has to do the work of computing the offset based on the letter
> spacing, and then using this macro to do the placement and orientation.  And I
> haven't seen anything equivalent to the code I wrote to convert a Spline using
> arbitrary values with a Spline that uses distances along the spline curve for
> values, so I think that's still useful.

I didn't have a lot of time when I was trying to find what I was looking for.

I think if you're able to locate (or someone can post a link to) Chris Colefax's
spline macros - my understanding is that there was all of that kind of stuff in
there as well.

I've never used any of these macros, and my memory tells me that the good macros
had something to do with a rollercoaster animation....

It's possible I might have some of these Colefax macros squirreled away
somewhere.
Won't have the opportunity to dig around for them and post until maybe Sunday.

We also really ought to have a thread where ALL of the Colefax macros are listed
and posted as attachments, and then they can be collected into a single zip so
that they aren't lost.

- BW


Post a reply to this message

From: Chris R
Subject: Re: Other things the text object can do.
Date: 7 Mar 2025 13:40:00
Message: <web.67cb3ca29216b80b53fb81ab5cc1b6e@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > "Chris R" <car### [at] comcastnet> wrote:
> >
> > > To prove my spline layout code is correct, I created some tools for converting a
> > > spline whose values have an arbitrary range into a spline whose values go from
> > > 0.0 to the computed length of the spline over the given range of values.  Using
> > > a spline that has been tuned this way gave a much better result in laying out
> > > the text.
> >
> > are you aware that there are spline macros to do this sort of thing?
> > IIRC, they are in transforms.inc
> >
> > - BW
>
> I knew in the back of my head that I had used the Spline_Trans macro before, but
> couldn't remember what it was called or where it was.  Thanks!
>
> I'll probably create a new version of my Text Spline alignment macro and replace
> my code for computing the rotations with this, which allow for banking the text
> as well, which would be cool.
>
> The macro still has to do the work of computing the offset based on the letter
> spacing, and then using this macro to do the placement and orientation.  And I
> haven't seen anything equivalent to the code I wrote to convert a Spline using
> arbitrary values with a Spline that uses distances along the spline curve for
> values, so I think that's still useful.
>
> -- Chris R

Time to move on, but here's the previous image using the new macro using
Spline_Trans with a Banking value of 1.0.  I used a more interesting font as
well.  The banking is subtle, but you can see it on the downward curve around
the "good people" section.

-- Chris R


Post a reply to this message


Attachments:
Download 'text_test.png' (95 KB)

Preview of image 'text_test.png'
text_test.png


 

From: Bald Eagle
Subject: Re: Other things the text object can do.
Date: 7 Mar 2025 15:25:00
Message: <web.67cb55859216b80ba5a6be6925979125@news.povray.org>
Also, of course, Friedrich Lohmueller's site.

https://www.f-lohmueller.de/pov_tut/animate/pov_anie.htm
(near bottom)


Post a reply to this message

From: Chris R
Subject: Re: Other things the text object can do.
Date: 10 Mar 2025 09:30:00
Message: <web.67cee8709216b80bcaf2d0115cc1b6e@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Also, of course, Friedrich Lohmueller's site.
>
> https://www.f-lohmueller.de/pov_tut/animate/pov_anie.htm
> (near bottom)

How could I forget that!  I used to take my morning coffee and pick a random
link from his site to explore things you can do in POV-Ray and how to do them.
If I had gone back to this, I would have seen the "Orient your object in the +Z
axis" comment, instead of my trial and error that found I had to rotate the text
objects 90 degrees!

-- Chris R


Post a reply to this message

From: Bald Eagle
Subject: Re: Other things the text object can do.
Date: 10 Mar 2025 09:50:00
Message: <web.67ceed8d9216b80b3bc22bca25979125@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > Also, of course, Friedrich Lohmueller's site.
> >
> > https://www.f-lohmueller.de/pov_tut/animate/pov_anie.htm
> > (near bottom)
>
> How could I forget that!

Because there is SO MUCH to take in, that eventually some information starts to
fall of the stack.

https://en.wikipedia.org/wiki/Dunbar%27s_number

And I'm sure that you've written enough code to have forgotten how the code you
wrote 3 days ago works, because it was _obvious_ at the time.  ;)

Glad you're having fun with POV-Ray and coding animations.  Sometimes we learn
new things in the process of revisiting and relearning old things.

And then we add those NEW lessons onto the stack!  :D

- BW


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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