CD3DFont uses textures to store a bitmap of the font. It sizes these
textures based on the font height, like so:
// Large fonts need larger textures
if( m_dwFontHeight > 40 )
m_dwTexWidth = m_dwTexHeight = 1024;
else if( m_dwFontHeight > 20 )
m_dwTexWidth = m_dwTexHeight = 512;
m_dwTexWidth = m_dwTexHeight = 256;
That's all fine and well, except some cards (and the Voodoos are the example
that always springs to mind) can't support textures of >256, so this code
won't work on those particular machines.
Becasue my game is designed to work on a large population of machines (some
of which use Voodoo 2's), I can't use this code. I tried to use only
256x256 textures and scaling the fonts instead, but the larger fonts come
out looking very bad (pixellated).
So, I'm looking for suggestions. Surely I'm not the only one who has run
into this problem.
I can think of two possibilities, both of which have drawbacks.
1) use system surfaces instead of textures: I *think* these have no size
limits (can anyone confirm?). This would allow larger fonts to use
appropriately sized surfaces. The drawback is I'd need to significantly
modify the DrawText routine to use surface locks (and catch and lock the
backbuffer surface as well), and copy data manually to the backbuffer,
instead of using vertex buffers, which isn't a hardware accelerated process,
and I could end up slowing the framerate down badly.
2) I could use multiple 256x256 textures for the larger fonts. The only bad
thing about this is that I'd have to switch the source texture, possibly
with every letter, and I don't think that'd be good for the frame rate
either! And it would complicate the DrawText routine as I'd have to
calculate, for each letter, on which texture that letter is sitting.
So, which way is better? Or is there some other method that y'all could
suggest? How would / did you handle this issue?
Creation is an act of sheer will
Manifest Destiny -- The Race for World Domination