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:03:53 EDT (-0400)
  Re: Other things the text object can do.  
From: Chris R
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


 

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