Jump to content

  • Log In with Google      Sign In   
  • Create Account

2D font rendering?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 jdub   Members   -  Reputation: 419

Like
0Likes
Like

Posted 26 February 2013 - 02:34 AM

So from what I understand, there are two ways to go about rendering fonts in DirectX 11.  A) you can load a texture with all of a font's characters as well as a text file mapping sections of the texture to actual ASCII values.  B) you can use the GDI to load and render fonts.


Which would be more suited towards rendering text at a relatively fast rate in my game?


J.W.

Sponsor:

#2 Erik Rufelt   Crossbones+   -  Reputation: 3633

Like
2Likes
Like

Posted 26 February 2013 - 07:01 AM

B is usually just a way to automatically generate the texture and the mapping for A in code, so they are equivalent.

Using B might be better if you use many different font-sizes and not the same letters all the time, to avoid saving massive textures and charactermaps, but otherwise using A directly is probably better so you don't have to have the GDI code in your game and can avoid generating the textures every time.

 

If you want a library that draws text for you, I made one a couple of years ago that uses B, but with DirectWrite instead of GDI: http://fw1.codeplex.com/


Edited by Erik Rufelt, 26 February 2013 - 07:03 AM.


#3 Gavin Williams   Members   -  Reputation: 776

Like
0Likes
Like

Posted 26 February 2013 - 07:27 PM

Why not just use Direct2D / DirectWrite ? Isn't that the best way to do fonts in DX11 ?

 

I would never consider GDI (is that even supported anymore ?). You could roll your own font-sheets as well, but for straight forward font rendering, D2D/DW is much easier and better quality.



#4 Flimflam   Members   -  Reputation: 657

Like
0Likes
Like

Posted 26 February 2013 - 10:36 PM

I would never consider GDI (is that even supported anymore ?).

Hell will probably freeze over before GDI disappears proper. However it's advisable that you use GDI+ for this type of stuff if you're even considering GDI. 



#5 Jason Z   Crossbones+   -  Reputation: 5312

Like
1Likes
Like

Posted 27 February 2013 - 09:21 AM

Why not just use Direct2D / DirectWrite ? Isn't that the best way to do fonts in DX11 ?

 

I would never consider GDI (is that even supported anymore ?). You could roll your own font-sheets as well, but for straight forward font rendering, D2D/DW is much easier and better quality.

Yes it is supported - even when technologies get deprecated they are still available on Windows for millenia...  That is one benefit that Windows developers often overlook.  The same complaints are going on right now about XNA - which is not in active development anymore, but will still be available for a long time to come...

 

I would never consider GDI (is that even supported anymore ?).

Hell will probably freeze over before GDI disappears proper. However it's advisable that you use GDI+ for this type of stuff if you're even considering GDI. 

This is right on - GDI+ is the way to go.  In fact, MJP has provided an implementation of this for Hieroglyph 3 that you can take a look at (see SpriteFontDX11 class).






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS