POV-Ray : Newsgroups : povray.beta-test : Circle_Text macro problem : Re: Circle_Text macro problem Server Time
30 Jul 2024 14:27:22 EDT (-0400)
  Re: Circle_Text macro problem  
From: Mike Williams
Date: 23 Oct 2001 17:56:59
Message: <Q89PiGAnde17Ew8z@econym.demon.co.uk>
Wasn't it Rune who wrote:
>"Mike Williams" wrote:
>> thus including the kerning of the current letter in
>> the positioning calculation, rather then just the
>> kerning of the previous letters in the string.
>
>Thanks!
>
>> I don't have the maiandb.ttf font on my machine, but
>> with other fonts, the two lines in your example file
>> look identical with that change.
>
>It sure is much better, but not exactly identical. Try the following code:

That effect seems to be being caused by something strange in the
behaviour of the TextWidth() macro.

If we rip out the "|" characters from the TextWidth() macro, like this:-

#macro TextWidth(Font, Text, Size)
   #local TO = text {ttf Font Text 1 0 scale <Size,Size,1>} 
   ((max_extent(TO).x-min_extent(TO).x))
#end

Together with my previous change, it looks a bit better.

In case anyone out there is using TextWidth() directly in their scenes,
it might be better to give my simplified version a different name and
use that throughout Circle_Text().

My version returns just the width of the string (which is what we now
need in the version of Circle_Text with corrected kerning). The current
TextWidth() returns the width of the string plus possibly some extra
space at the ends.

> You seem to understand the macro well, so could you possible do 
> another change to it?
> I'd like to have a spacing option added that works like the x 
> component of the offset vector in regular fonts in POV-Ray.

That's easy. Just pass that value into the Circle_Text() macro, and pass
it forward into the (new) TextWidth() macro and use it as the x
component of the offset vector in the local text object, like this:-

#macro TextWidth(Font, Text, Size, Offset)
   #local TO = text {ttf Font Text 1 Offset*x scale <Size,Size,1>} 
   ((max_extent(TO).x-min_extent(TO).x))
#end

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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