Sign in to follow this  

SlimDx/Dx9 font quality, pitch and precision

This topic is 2840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I´ve been working on a 2D rendering engine using (C#) with SlimDx and Dx9 for a while. Performance is great, and everything works like a charm. The other day I started experimenting with different font settings, and found to my surprise that using different font properties doesn't change the output except in a few rare cases. I decided to delve into this, and have reduced my code to a bare-minimum sample. Basically I iterate in three nested loops the SlimDx.Direct3D9.FontQuality, SlimDx.Direct3D9.PitchAndFamily and SlimDx.Direct3D9.Precision enums, and print out the text "The quick brown fox...". This way I can see all combinations. My biggest issue is that there is no difference between using NonAntialiased and Antialiased. They are identical. The only ones that differ are ClearType and ClearTypeNatural. Has anyone else tried this? I'd be more than happy to provide my sample code and screenshots. There are of course many different configuration parameters that can be changed when setting up the device. But since I'm doing pure 2D, I have disabled most 3D effects like lighting, depth stencils and the like. I have tried with MultiSampleTypes and qualities also, but no difference. I'm instantiating a new SlimDx.Direct3D9.Font using the ctor like this: Font dx9Font = new Font(Context9.Device, 14, 0, FontWeight.Normal, 0, false, CharacterSet.Default, precision, quality, pitch, "Arial")); then I invoke dx9Font.DrawString(null, ...). Have I missed something obvious?

Share this post


Link to post
Share on other sites
The only thing I could find from the DirectX documentation was (in regards to the quality parameter):
Quote:
Specifies how Windows should match the desired font with a real font. It applies to raster fonts only and should not affect TrueType fonts.

So if you're using a TrueType font, I wouldn't expect most of the quality options to have any effect. Also, a lot of those options are completely dependent on which font you're using, so try experimenting with that and see if it helps at all.

I believe the D3DX Font object is simply using GDI internally, so you're going to be subject to any restrictions that GDI suffers from. If you want really flexible and high quality text, you probably need to use DirectWrite, which isn't trivial to set up and doesn't support XP

Share this post


Link to post
Share on other sites
Thanks, I didn't think about which font I'm using. I'll experiment a little with different fonts, and see what happens. I have actually been experimenting with DirectWrite also, and like you say, the font styling is vastly superior.

Share this post


Link to post
Share on other sites

This topic is 2840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this