🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Bugger

posted in DruinkJournal
Published August 08, 2006
Advertisement
Well, my font manager isn't as clever as I thought it was. I just realised that it's storing a new texture in the texture manager for each text item on screen, not once for the font object. So I'll have to look into that.
I'm not convinced this will work too smothly to be honest. The texture gets updated whenever a new glyph gets added to it, which means re-adding it to the texture manager, which is pretty expensive to do (Locking a static texture). So it'll have pretty bad performance initially, but should get better.

So, it looks like I'm going to be writing my own font loading code too. I was going to do so anyway, so I can do bitmap fonts, but I didn't reckon on writing a TTF renderer too. Although if I do, I can overlay textures on TTFs too. Which could be nice.

Anyway, it's low prioriry just now. ID3DXFont will do just now.
Previous Entry Eww, ID3DXSprite. Eww.
Next Entry Untitled
0 likes 2 comments

Comments

Jason Z
Steve, you could still use ID3DXFont to load the glyphs and just draw the entire alphabet to a texture, and use that for the input to your custom rendering. Then you can have your speedy custom system, and don't have to worry about how to load various fonts, font sizes and the like. What do you think?
August 08, 2006 08:52 PM
Evil Steve
I could, but there's no guarantee where on the texture ID3DXFont will stick the glyphs, so I can't reliably take them off of it. Just because they're grid aligned and 32x32 in this version of the SDK, doesn't mean they'll always be.

I think just writing my own renderer should be pretty straightforwards. I'm creating an offscreen plain, and using GetDC and GDI calls to render to it, then I'm going to lock a target texture and the offscreen plain, and copy glyphs across. I'd still like to know how ID3DXFont gets the glyphs onto the surface in the first place, since I didn't notice any calls to CreateOffscreenPlainSurface() when I was digging around in it. My guess is that it renders to a DIB/DDB, and then copies bits like that. I'll investigate that too, and probably post a journal update about this later today.
August 09, 2006 03:57 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement