Font conundrum

Jones
Unregistered
 
Post: #1
I'm working on making a simple interface system for my games/programs. And I've got a little problem. I've used FTGL until now for fonts and such, which is great, until you want to size a button, or title bar to match the font. Fonts are spcified in pt's with FTGL, and since there is no way to convert pt's to pixels... I'm stuck. So, I say to myself, "Well, my font's dont have to be fancy, maybe some simple character-mapped blocks will work." By "character mapped" I mean like this:

Letter "V":

Code:
int v[] = {1,0,0,0,0,1,
            0,1,0,0,1,0,
            0,0,1,1,0,0,
            0,0,0,0,0,0}

And then I would have my code interpret the 1/0's to draw pixels to form letters onscreen. Then it hit me... this is gonna take a long time, for every letter, and some might not work out. Like *horror*... letter 'y'.

So, what about a simple font stored as an image, which I would then load with OpenIL, and display with OpenGL, while playing a song with OpenAL (open this, open that... Rasp). I believe this is called font bitmapping. So I go about searching on macupdate and versiontracker and I found *ONE* piece of software... BitFonter 2. It's not free, and looks complicated. I just need to generate, or use something pre-generated a font, plain and simple. Smile

Either that or figure out how to convert PX's to PT's. Rasp

Anyway, suggestions?

Thanks!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
FTGL works a consistent unit (pt, I think)... what size you draw that unit is entirely up to you.
Quote this message in a reply
Jones
Unregistered
 
Post: #3
OneSadCookie Wrote:FTGL works a consistent unit (pt, I think)... what size you draw that unit is entirely up to you.

But I have no idea how to set that size. Frankly, FTGL's documentation sucks. Sorry, but it's true. They seem to have a command for setting up bounding boxes, but of course the explanation was one sentence long and gave no examples.

Grr. Maybe if I just borrowed the font bitmap from Jedi Knight II, just maybe Raven Soft wouldn't notice. Wink
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
You set the font size (in points) when you create the font, I think.

FTGL will tell you how big your string is, in points, I think.

As I said earlier, how big it is on the screen is *entirely up to you*. There's no way FTGL can tell you that.
Quote this message in a reply
Jones
Unregistered
 
Post: #5
How big it is on the screen is entirely up to FTGL, you give it a size in PT's and it draws it in pixels, on the screen acoordingly.

I need the pixel size!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
FTGL uses whatever OpenGL state you've set up. That means the size is entirely up to you. More than that, which state affects it depends on which kind of FTGL font you're using.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #7

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Jones
Unregistered
 
Post: #8
Right then... alternatives to FTGL?

If none are any good, I'll just use textures holding fonts. Or better yet... my game will have no actual text in it. Which is feasible, all my buttons could be textures. Rasp But I'd rather not do that.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #9

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Jones
Unregistered
 
Post: #10
unknown Wrote:have a look at http://zakariya.net/shamyl/etc/GlyphGen.zip

Wow... that's really good. I spotted the link to that in the other thread, but I wasn't sure if it was the latest version, or if I'd have to build it myself and debug it, which I'm too lazy to do. And yet I was willing to write out every letter imaginable with 1's and 0's for my own font header. Hmmm. Rasp

Thanks!

(How's GLUT-font for performance? Just for chucking an fps meter or something, and some hud text.)
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #11
GLUT's fine, I would use glutStrokeCharacter for an fps meter though.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Jones
Unregistered
 
Post: #12
unknown Wrote:GLUT's fine, I would use glutStrokeCharacter for an fps meter though.

Any reason why? Performance, or just visual appeal...

I figured GLUT would be faster than say, loading something from GlyphGen pics and display them on quads.
Quote this message in a reply
Jones
Unregistered
 
Post: #13
Nuther question: (Again!)

If I wanted to simulated colorkey behavior like in SDL, I would need to write my own function to do so or use a third party plugin/library, correct?

Is there any other format besides TIFF that allows for a transparent background, or transparency? DevIL/OpenGL have trouble with TIFFs. Specifically, it just paints them all red or tints reddish/pinkish. As although pink font is cool, it's not really the look one would go for when designing an FPS or something.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #14
pngpngpngp

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #15
PNG is the usual format to use for full 8-bit transparency support.
Quote this message in a reply
Post Reply