by Michael S. Kaplan, published on 2008/03/01 10:16 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2008/03/01/7971061.aspx
Please read the disclaimer; content not approved by Microsoft!
Developer Josh asked:
I understand you can call SystemParametersInfo with SPI_GETCLEARTYPE to see if Cleartype is enabled, but according to MSDN, SPI_GETCLEARTYPE isn’t supported on winXP. How can I find out if it’s enabled on a winXP system?
What I have always disliked functions like SystemParametersInfo (a dislike that extends to functions like GetLocaleInfo) is that it becomes a dumping ground of data/configuration with mounds of new items added with each version, and often the documentation and sometimes even the header files don't match what is actually implemented.
Plus even if the documentation is right, if you look at how clusters of similar functionality are used, you can look at the steps and missteps that the platform took over the years as features were implemented, modified, tweaked, and extended.
But let's look at all of the anti-aliasing/hinting items in SystemParametersInfo for a moment. I changed a bit of the formatting info and split the "supported by platform _____" in a separate column. It could probably do with some more work but this is a start at least....
I also fixed up some of the really weird inconsistencies like the fact thatt he first instance of ClearTyoe had no link but an inline definition and such...
Desktop parameter First Supported Meaning
ClearType is a software technology that improves the readability of text on liquid crystal display (LCD) monitors.
Determines whether the font smoothing feature is enabled. This feature uses font antialiasing to make font curves appear smoother by painting pixels at different gray levels.
The pvParam parameter must point to a BOOL variable that receives TRUE if the feature is enabled, or FALSE if it is not.
Retrieves a contrast value that is used in ClearType smoothing. The pvParam parameter must point to a UINT that receives the information. Valid contrast values are from 1000 to 2200. The default value is 1400.
Retrieves the font smoothing orientation. The pvParam parameter must point to a UINT that receives the information. The possible values are FE_FONTSMOOTHINGORIENTATIONBGR (blue-green-red) and FE_FONTSMOOTHINGORIENTATIONRGB (red-green-blue).
Retrieves the type of font smoothing. The pvParam parameter must point to a UINT that receives the information. The possible values are FE_FONTSMOOTHINGSTANDARD and FE_FONTSMOOTHINGCLEARTYPE.
Turns ClearType on or off. The pvParam parameter is a BOOL variable. Set pvParam to TRUE to enable ClearType, or FALSE to disable it.
ClearType is a software technology that improves the readability of text on LCD monitors.
Enables or disables the font smoothing feature, which uses font antialiasing to make font curves appear smoother by painting pixels at different gray levels.
To enable the feature, set the uiParam parameter to TRUE. To disable the feature, set uiParam to FALSE.
Sets the contrast value used in ClearType smoothing. The pvParam parameter is the contrast value. Valid contrast values are from 1000 to 2200. The default value is 1400.
SPI_SETFONTSMOOTHINGTYPE must also be set to FE_FONTSMOOTHINGCLEARTYPE.
Sets the font smoothing orientation. The pvParam parameter is either FE_FONTSMOOTHINGORIENTATIONBGR (blue-green-red) or FE_FONTSMOOTHINGORIENTATIONRGB (red-green-blue).
Sets the font smoothing type. The pvParam parameter is either FE_FONTSMOOTHINGSTANDARD, if standard anti-aliasing is used, or FE_FONTSMOOTHINGCLEARTYPE, if ClearType is used. The default is FE_FONTSMOOTHINGSTANDARD.
SPI_SETFONTSMOOTHING must also be set.
Obviously the alphabetical order is best for lookups, but the odd coverage variability makes it kind of weird, anyway.
A chronological order might be better for looking at the order they came into being, and one with dependencies clearly divided out rather than inline with the text could also be useful.
But to answer Josh's question, while SPI_GETCLEARTYPE claims to not be supported until Vista (as you can see in the tale as well), it does appear to be in the XP code base so it might work. But let's be cautious and not do that -- we can actually just check for
and then one is working with flags that are supported in any platform XP and up, when ClearType was first added to Windows....
The new flags were probably added top try to make it easier to sort through asll these strange settings, but did it really help? Did it really help anything at all, especially since it never bothered to explain what it was equivalent to, something that even GetLocaleInfo with its overlpping LCTYPE values tries to do.
But do all of these random collected flags feel like the most usable UI? Are they what would be there if one was working from scratch, even if they had to handle the backcompat support story too? Now it is like spaghetti documentation!
If I were tasked to fix this (and had any documentation writing ability!), I would start them all from scratch, include not just deoendency info like the topic does now but also more interaction info and even historical equivalencies....
This blog brought to you by ⎚ (U+239a, aka CLEAR SCREEN SYMBOL)
go to newer or older post, or back to index or month or day