POV-Ray : Newsgroups : povray.unix : Announce:Text justification assistant script Server Time
28 Jul 2024 18:23:33 EDT (-0400)
  Announce:Text justification assistant script (Message 1 to 10 of 10)  
From: bloke
Subject: Announce:Text justification assistant script
Date: 27 Oct 1999 20:46:07
Message: <3817AAD3.A86A5CAC@the.place>
Hello all,

Non unix folk beware.... if you've never heard of bash, leave now.

I got mad with rendering scenes again and again to get the text
alignment right. This got more maddening when I tried to set up scripts
to generate pov scenes involving text, right aligning text is a real
arse. I saw a patch for the 'ol 3.02 windoze version. So I stopped
getting mad and got even.

I wrote a bash script which uses Povray, ImageMagick, sed & tr to render
a string, in a specified font, at a specified kerning offset, find the
edges, and the offsets from origin. The output can be sieved for
relevant info.

Example session:

$ ./povttfsize "Howdy" arial.ttf
totalsize=2.970,.930
positive from origin=2.410,.720
negative from origin=.560,.210

this admittedly takes ages to run, but if you're gonna use a load of
font stuff in a scene it could be scripted for all the strings and run
overnight!

If anyone wants a copy, please mail me qua### [at] netcomukcouk, if there's
sufficient interest I'll post it to the group. It does what I wanted
(vaguely) and if you want to improve on it you'll be making my life
easier.


Post a reply to this message

From: bloke
Subject: Re: Announce:Text justification assistant script
Date: 27 Oct 1999 21:16:07
Message: <3817B1DB.C291CD6A@the.place>
Oops!, I used an older (failed) test version for the example.
try this:


$ ./povttfsize "Howdy" arial.ttf
totalsize=2.9700,.9300
positive from origin=2.9700,.7200
negative from origin=0,.2100

DOH!


Post a reply to this message

From: Nieminen Juha
Subject: Re: Announce:Text justification assistant script
Date: 28 Oct 1999 04:23:19
Message: <381807f7@news.povray.org>
In povray.unix blo### [at] theplace wrote:
: this admittedly takes ages to run

  Perhaps a C-version would be faster and more portable?

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: bloke
Subject: Re: Announce:Text justification assistant script
Date: 28 Oct 1999 06:01:39
Message: <38181F02.77B5A253@the.place>
I quite agree about portability, however, I'm using povray to actually render
the text using an orthographic camera, then using image magick a couple of
times to determine the relevant info. Writing this in 'c' would either mean
including Image magick and povray or calling them as externals. Either way
the speed would hardly change at all. The best fix would be to write the
relevant commands straight into povray itself, which is a bit beyond the
scope of a quick fix.

Nieminen Juha wrote:

> In povray.unix blo### [at] theplace wrote:
> : this admittedly takes ages to run
>
>   Perhaps a C-version would be faster and more portable?
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Chris Huff
Subject: Re: Announce:Text justification assistant script
Date: 28 Oct 1999 07:10:18
Message: <38182FAE.7B185C8C@yahoo.com>
>The best fix would be to write the relevant commands straight into
povray itself, which is a bit beyond the scope of a quick fix.<

It wouldn't be too hard though...just put a place in the code that
translates the object based on the justification settings and the
bounding box.


Post a reply to this message

From: Nieminen Juha
Subject: Re: Announce:Text justification assistant script
Date: 28 Oct 1999 09:08:06
Message: <38184ab6@news.povray.org>
It shouldn't be hard to get any information you want from a raw tga file
by reading and analyzing it. It's a very simple format.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: bloke
Subject: Re: Announce:Text justification assistant script
Date: 28 Oct 1999 15:59:06
Message: <3818B909.46968915@the.place>
>   It shouldn't be hard to get any information you want from a raw tga file
> by reading and analyzing it. It's a very simple format.

I'll have a look for some tga docs, this eliminate the need for
ImageMagick.

If theres a quick way to get aquainted with the algorythms used in ttf
and the way povray handles ttf (or Xfonts for that matter), then that
would be the quickest one, because it could just prod the font file,
instead of running a render. I just need to know (without extensive
knowledge of povray internals) the rules povray uses to space and align
text. The font info should be trivial?

It would be good to keep this as a seperate tool for now so that people
can avoid rebuilds, for instance I use macs, nt boxes, 95boxes, Amigas
and linux boxes for rendering, but I only have worthwhile compilers on
Linux as this is my working environment. I figure povray will probably
have to 'grow' commands to do this in a future release anyway. This way
I can generate scenes for any version of povray.


Post a reply to this message

From: Jon A  Cruz
Subject: Re: Announce:Text justification assistant script
Date: 29 Oct 1999 00:31:32
Message: <38192369.CA5FE3BE@geocities.com>
blo### [at] theplace wrote:

> If theres a quick way to get aquainted with the algorythms used in ttf
> and the way povray handles ttf (or Xfonts for that matter), then that
> would be the quickest one, because it could just prod the font file,
> instead of running a render. I just need to know (without extensive
> knowledge of povray internals) the rules povray uses to space and align
> text. The font info should be trivial?
>
> It would be good to keep this as a seperate tool for now so that people
> can avoid rebuilds, for instance I use macs, nt boxes, 95boxes, Amigas
> and linux boxes for rendering, but I only have worthwhile compilers on
> Linux as this is my working environment. I figure povray will probably
> have to 'grow' commands to do this in a future release anyway. This way
> I can generate scenes for any version of povray.

Well, if that is some of what you are looking at...

You should consider doing something in Java. Can run on most those boxes you
mentioned without even a recompile (although the Amiga is a little of a
squeeze).

I recently coded up a quick Java/Swing tool to view the chunks of a .TTF file
and to display info on the encoding tables. About 2 days to get that done.

It's not too hard to follow the algorithms in the POV-Ray sources.

--
"My new computer's got the clocks, it rocks
But it was obsolete before I opened the box" - W.A.Y.


Post a reply to this message

From: Ken
Subject: Re: Announce:Text justification assistant script
Date: 29 Oct 1999 00:36:08
Message: <381923A1.D32D0C2C@pacbell.net>
"Jon A. Cruz" wrote:

> You should consider doing something in Java.

For some reason many of your replies remind me of the Willie Nelson song-

...java's always on my mind !

:)

-- 
Ken Tyler -  1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Psychomek
Subject: Re: Announce:Text justification assistant script
Date: 5 Nov 1999 07:02:34
Message: <3822C797.75F4ECA4@cyberhighway.net>
Ken wrote:

> "Jon A. Cruz" wrote:
>
> > You should consider doing something in Java.
>
> For some reason many of your replies remind me of the Willie Nelson song-
>
> ...java's always on my mind !
>
> :)
>
> --
> Ken Tyler -  1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
> http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/

As a Georgia and a Coffee drinker I resent and resemble that remark!


Post a reply to this message

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