Jump to content
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    423433

Bugger

Sign in to follow this  
Evil Steve

104 views

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.
Sign in to follow this  


2 Comments


Recommended Comments

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?

Share this comment


Link to comment
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.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!