PDA

View Full Version : Questions on TrueType fonts



MickeyMouse
06-09-2003, 12:45 AM
Hi!
I was working on TrueType fonts in my GL apps and using WGL extension wglUseFontBitmaps(...) faced some problems, here they are:

1. How to compute each character's width?
In TT fonts each char may have different width - I need to know them in order to do "lines wrapping" properly.

2. Extension I mentioned above creates display lists using "OpenGL bitmaps". In order to draw such bitmap valid raster position is required (valid means on the screen).
...but how to display bitmaps being, say half-visible in such way that raster position for them would be out of the screen bounds? - the result of culling out raster position by OpenGL is quite undesired (not wanted at least) in this case, since when I call sth like glCallLists(6, GL_BYTE, "lalala"); and at least first letter's ('l') raster position is say (-1, 0), whole text doesn't show up.

3. A little problem is also the speed of TT fonts with display lists, which seems to be the fastest option under OpenGl. It gets really slow (down to several FPS on PII300 - I know it's a slow machine, but still) when I cover the screen with sth like 80x40 lines of text. Maybe wglUseFontBitmaps(...) puts some extra "stuff" into display lists, like lots of state changes?

Thanks everyone who can help...
Hope it's clear.

[This message has been edited by MickeyMouse (edited 06-09-2003).]

V-man
06-09-2003, 03:32 AM
1. maybe your OS has a function like GetExtends

have you read through this? It's a couple of posts down.
http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/009649.html