Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411505 Posts in 69374 Topics- by 58429 Members - Latest Member: Alternalo

April 25, 2024, 09:21:49 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Font smoothing
Pages: [1]
Print
Author Topic: Font smoothing  (Read 2762 times)
Will Vale
Level 4
****



View Profile WWW
« on: August 13, 2008, 06:49:58 PM »

Hi all,

For a long time I've used bitmap fonts created with various versions of (or tools derived from) the venerable FontMaker from the DXSDK. (They don't appear to include it anymore though, which is a pity.)

The problem with this is that it uses the current OS font smoothing setting to render out the font bitmaps, and on my current PC I can't enable standard font smoothing, only ClearType for some reason. Obviously I don't want ClearType because the RGB subpixel fringes don't give the right results for the glyph bitmaps.

Anyone know a way to forcibly enable/disable Standard font smoothing on XP? Not the normal Control Panel route - I've tried that.

Cheers,

Will
Logged
Zaknafein
Level 4
****



View Profile WWW
« Reply #1 on: August 13, 2008, 06:58:30 PM »

Right-click on desktop, Appearance tab, Effects button, and it's one of the listboxes there. Smiley
Logged

Will Vale
Level 4
****



View Profile WWW
« Reply #2 on: August 13, 2008, 07:46:13 PM »

Thanks for the help, but sadly that's the Control Panel method I was referring to:

Quote from: Will Vale
Not the normal Control Panel route - I've tried that.

Desktop Properties is just a shortcut to the Display Properties Control Panel applet - which is the one that doesn't work. Sad

I did a bit more research on MSDN and found two answers:

* You can change the global font smoothing setting programmatically using SystemParametersInfo.

* (Better) You can request a specific font quality at creation time using LOGFONT::lfQuality.

I did the second one, and it works nicely - I get the right output from FontMaker whatever the global smoothing is set to. Doesn't explain why global standard smoothing has no effect, but it's no longer a problem.

Will
Logged
Zaknafein
Level 4
****



View Profile WWW
« Reply #3 on: August 13, 2008, 08:28:30 PM »

D'oh! Yeah, I was under the impression that you couldn't find it in the Control Panel. Embarrassed
Well glad you found your answer anyway!
Logged

Will Vale
Level 4
****



View Profile WWW
« Reply #4 on: August 14, 2008, 03:12:45 PM »

Me too, I'd be sorry to have to switch font formats.

I'm still at the mercy of one apparent limit, which is that there isn't any standard smoothing for fonts under 14 pixels. I'm not sure why this is, whether it's a Windows thing or a per-face thing.

I'm also intending to test it all on Vista and see whether I get any better behaviour there.
Logged
Kaelan
Level 1
*


Malcontent


View Profile WWW
« Reply #5 on: August 16, 2008, 03:07:12 AM »

Have you tried using GetGlyphOutline (http://msdn.microsoft.com/en-us/library/ms534013(VS.85).aspx) in bitmap mode? It allows precise control over the level of smoothing quality, and works on characters of any size. If you crank it up to the maximum (GGO_GRAY8_BITMAP), it actually looks better than normal smoothing and almost as good as ClearType (though it's not subpixel smoothed).

You can see some (badly documented) C++/lua code that uses it here:
http://code.google.com/p/fracture/source/browse/trunk/src/image/image.cpp?r=33
It's a sort of freaky API, but it works quite well (and on basically every modern Win32 OS).
Logged

Will Vale
Level 4
****



View Profile WWW
« Reply #6 on: August 18, 2008, 12:14:19 AM »

That looks just the ticket, thanks for the tip!
Logged
muku
Level 10
*****


View Profile
« Reply #7 on: August 18, 2008, 10:36:10 AM »

Stupid question: why not simply use FreeType 2?
Logged
Will Vale
Level 4
****



View Profile WWW
« Reply #8 on: August 18, 2008, 03:15:04 PM »

Fair question - I guess the answer is that I already have the tool, data format and font code - this way I don't have to do work for the sake of it...

I tried to find some comparisons of TrueType and FreeType 2 font hinting (the auto hinter, not the patented one) and some of what I saw looked quite promising - do you have a feel for the relative quality?

I'll certainly consider FreeType when I look at replacing ExtTextOut with GetGlyphOutline - there is likely a similar amount of work involved. But not until after August Smiley

Logged
muku
Level 10
*****


View Profile
« Reply #9 on: August 18, 2008, 03:23:48 PM »

Fair question - I guess the answer is that I already have the tool, data format and font code - this way I don't have to do work for the sake of it...

That's the idea I got from your original post; when someone brought up the GetGlyphOutline stuff, though, I got the impression that you were willing to reimplement the tools. In that case it might make sense to use an established, high-quality cross-platform library such as FreeType.

Quote
I tried to find some comparisons of TrueType and FreeType 2 font hinting (the auto hinter, not the patented one) and some of what I saw looked quite promising - do you have a feel for the relative quality?

Sorry, no, I have no experience with that; I have used FT2 before, but without hinting (at least not knowingly, I can't recall whether it has to be enabled or it does it automatically).
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic