Pixel debris when using Large CD3DFont

Pixel debris when using Large CD3DFont

Post by Laurent T » Sat, 16 Feb 2002 05:03:34



Hi,

When using large CD3DFont font size, the text is incorrectly rendered for
some characters, lowercase U with Impact-40 Bold, for example. The faulty
letters are always the same for a given font, font size, font attribute
combination.

I searched the DIRECTXDEV archives and found nothing but ugly hacks like :

Search for the line:
        x += size.cx+1;
and replace it with:
        x += size.cx+10;

or

// Correction 73=I 76=L 105=i 108=l
if(c==73||c==76||c==105||c==108)
   x += 2*size.cx+1;
else
   x += size.cx+1;

Does anyone has a better solution?
--
Laurent TESTUD - http://www.lafaqmfc.com/

 
 
 

Pixel debris when using Large CD3DFont

Post by Philip Taylor [MS » Sat, 16 Feb 2002 06:12:45


CD3DFont is nothing more or less than a helper class for the samples. its
provided "as-is" and may not be appropriate for all uses.

you do have the source, though, so you can use it to produce a more robust
3D font helper class.

--
Phil Taylor
PM : DirectX SDK, Managed DirectX, WindowsXP Inbox 3D Screensavers, and a
few more bits and bobs
http://msdn.microsoft.com/directx
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:> Hi,

> When using large CD3DFont font size, the text is incorrectly rendered for
> some characters, lowercase U with Impact-40 Bold, for example. The faulty
> letters are always the same for a given font, font size, font attribute
> combination.

> I searched the DIRECTXDEV archives and found nothing but ugly hacks like :

> Search for the line:
>         x += size.cx+1;
> and replace it with:
>         x += size.cx+10;

> or

> // Correction 73=I 76=L 105=i 108=l
> if(c==73||c==76||c==105||c==108)
>    x += 2*size.cx+1;
> else
>    x += size.cx+1;

> Does anyone has a better solution?
> --
> Laurent TESTUD - http://www.lafaqmfc.com/


 
 
 

Pixel debris when using Large CD3DFont

Post by Laurent T » Sun, 17 Feb 2002 14:25:58


Even provided "as is", I do think that the utility classes provided with the
SDK are a very good base to build on. I was hoping that someone had already
fixed this problem.

I started working on this little issue and fixed it. ( a "little" off by one
error ) However, I had no time to make any extensive testing. I also added
the fix proposed by another poster a few weeks ago, made some changes so
that the smallest texture size is used, and provided support for longer
strings and batches of text display. ( Differed rendering is significantly
increasing performance )

Anyone interested with these mods, email me...

Laurent
--
Laurent TESTUD - http://www.lafaqmfc.com/



> CD3DFont is nothing more or less than a helper class for the samples. its
> provided "as-is" and may not be appropriate for all uses.

> you do have the source, though, so you can use it to produce a more robust
> 3D font helper class.

> --
> Phil Taylor
> PM : DirectX SDK, Managed DirectX, WindowsXP Inbox 3D Screensavers, and a
> few more bits and bobs
> http://msdn.microsoft.com/directx
> This posting is provided "AS IS" with no warranties, and confers no
rights.


> > Hi,

> > When using large CD3DFont font size, the text is incorrectly rendered
for
> > some characters, lowercase U with Impact-40 Bold, for example. The
faulty
> > letters are always the same for a given font, font size, font attribute
> > combination.

> > I searched the DIRECTXDEV archives and found nothing but ugly hacks like
:

> > Search for the line:
> >         x += size.cx+1;
> > and replace it with:
> >         x += size.cx+10;

> > or

> > // Correction 73=I 76=L 105=i 108=l
> > if(c==73||c==76||c==105||c==108)
> >    x += 2*size.cx+1;
> > else
> >    x += size.cx+1;

> > Does anyone has a better solution?
> > --
> > Laurent TESTUD - http://www.lafaqmfc.com/

 
 
 

1. Large Fonts and CD3DFont and texture limits

Hey gang,

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;
     else
         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?

Thanks,

Ron
--
Creation is an act of sheer will
Manifest Destiny -- The Race for World Domination
http://www.RJCyberware.com

2. ->typography and design <-

3. After drawing text using CD3DFont class, images are not rendering

4. Alias Wavefront Bulletin Board

5. Changing pixel size to larger size

6. Fast Cash It′s TRUE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

7. How to determine haw large a form is in pixels

8. CG News, Everyday, The CG Channel

9. iExpress Blotches & Large Pixels

10. Need help:Flying debris caused by explosions

11. How do i make spinning debris?

12. Slider leaves debris

13. Large POV Files (How Large is Large ?)