POV3 Font Metrics?

POV3 Font Metrics?

Post by Scott Earnes » Thu, 14 Aug 1997 04:00:00



Apologies if this is a FAQ, it's been a while since I've visited here.

Playing around with POV for the first time in a while, and I'm coming
back to something I keep having a program with.  Is there any way that,
given the dimensions of TrueType fonts, is there a way to *accurately*
determine the height and width of a text object, without having to do
guesstimate, move, guesstimate, etc.?  The documentation (unless it's
been recently updated) doesn't appear to have any leads.  Anyone know of
or write a program which will accept a font file and a text string, then
return height and width?  Something like that would save me a HUGE
amount of time, thanks!

--
Scott Earnest        | We now return you to our regularly |

 
 
 

POV3 Font Metrics?

Post by des » Fri, 15 Aug 1997 04:00:00




Quote:> Playing around with POV for the first time in a while, and I'm coming
> back to something I keep having a program with.  Is there any way that,
> given the dimensions of TrueType fonts, is there a way to *accurately*
> determine the height and width of a text object, without having to do
> guesstimate, move, guesstimate, etc.?

 Use POV.
 Write code that provides you with a set of axes with
hashmarks - add your object{text{...}}.
 Then, by inspection, you have your metrics.

des

 
 
 

POV3 Font Metrics?

Post by Scott Earnes » Sun, 17 Aug 1997 04:00:00





> > Playing around with POV for the first time in a while, and I'm coming
> > back to something I keep having a program with.  Is there any way that,
> > given the dimensions of TrueType fonts, is there a way to *accurately*
> > determine the height and width of a text object, without having to do
> > guesstimate, move, guesstimate, etc.?

>  Use POV.
>  Write code that provides you with a set of axes with
> hashmarks - add your object{text{...}}.
>  Then, by inspection, you have your metrics.

Suggestion appreciated, but that's not quite what I'm looking for (and
it's not that different from what I'm doing already).

Consider:  

Each character has a definite height and width in font units (from
reading, it looks like TTF has its own internal scale).  Seems to me, it
would be possible to write a program which, for each character:

1.)  checks each character's dimensions, stores upper-bound and
lower-bound sizes for determining over-all height,
2.)  gets the left-most and right-most coordinates to determine width,
then adds that to a running total, then
3.)  adds space and accounts for kerning if another letter follows.

With that, the actual string length could be determined, then scaled
into POV-world coordinates.  I've tried reading the TrueType
specification as published by Microsoft, and it's giving me headaches
trying to get any practical information out of it.  I'm also looking
into the Windows API for calls to write a Windows program, but it's only
slightly less cryptic to me -- and even after I do that, I'm still not
sure how to scale the font coordinates to POV coordinates.

Ideas, anyone?  Possibly anyone on the POV Team who worked on the text
object code who could give some pointers?  Or maybe I'm getting into
something better directed at a programming newsgroup?

Again, thanks!

Quote:> des

--
Scott Earnest        | We now return you to our regularly |

 
 
 

POV3 Font Metrics?

Post by PoD » Mon, 18 Aug 1997 04:00:00





> > > Playing around with POV for the first time in a while, and I'm coming
> > > back to something I keep having a program with.  Is there any way that,
> > > given the dimensions of TrueType fonts, is there a way to *accurately*
> > > determine the height and width of a text object, without having to do
> > > guesstimate, move, guesstimate, etc.?

I've just done a quick hack of the POV truetype source and come up with
a program that
will output the dimensions of the bounding box for a text object.
I've tried it out on a couple of examples and it seems to work.

If there are any legal hassles about giving this away could someone let
me know,
otherwise anyone who wants it can have it.

BTW it's very rough and probably easy to crash by wrong params etc.

------------------------------------------------------------------

------------------------------------------------------------------

 
 
 

1. Q: Font metrics returned by wglUseFontOutlines

Hi,

    I have a question about the wglUseFontOutlines function. I can
retrieve the GLYPHMETRICSFLOAT array for the font, if I specify a
pointer to a large enough array in the last parameter to
wglUseFontOutlines. The problem is, that those values have some format
I cannot work with. I found the following in the online MSDN library:

"[...] The em square size of the font, the notional grid size of the
original font outline from which the font is fitted, is mapped to 1.0
in the x- and y-coordinates in the display lists. [...]"

But this does not help any, since I do not know what they mean by "em
square size of the font". Neither do I know how to retrieve this
value.

I am drawing the font in ortho mode (configured, so one unit is one
pixel). So when I render any text, it is really small on screen. I
tried a glScale by 100.0f or 50.0f. This does in fact make the text
readable, but it is no the result I am expecting. I am expecting the
same font to have the same height, regardless whether it was drawn
using the Windows GDI or OpenGL. Basically, this is why I want to
convert those unti-values to pixel-values.

Help is very much appreciated!
jb

2. Image file formats

3. It's time for Metric fonts

4. filtering text

5. OpenGL in Linux

6. Problem:POV3.1 media vs POV3.0 atmosphere ...

7. POV3 DOS faster than POV3 WIN

8. pov3 beta win95: render & exit pov3

9. 3D fonts, 3D fonts from 2D fonts, common fonts data

10. fonts FONTS fonts

11. fonts fonts fonts!