POV-Ray : Newsgroups : povray.binaries.images : Other things the text object can do. : Re: Other things the text object can do. Server Time
14 Mar 2025 08:05:47 EDT (-0400)
  Re: Other things the text object can do.  
From: Leroy
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

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