summaryrefslogtreecommitdiff
path: root/pango/pangowin32-fontcache.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2002-03-17 21:25:16 +0000
committerTor Lillqvist <tml@src.gnome.org>2002-03-17 21:25:16 +0000
commit87d7dc354f46b00e4835a7136b56a35edada5bf2 (patch)
tree7808712bf915719102f6f3dc953ed4753f8e8128 /pango/pangowin32-fontcache.c
parente3bc68e7ee786503c41846c7f38e8d8afb9f0232 (diff)
downloadpango-87d7dc354f46b00e4835a7136b56a35edada5bf2.tar.gz
Add pango_win32_os_version_info variable, an OSVERSIONINFO struct.
2002-03-17 Tor Lillqvist <tml@iki.fi> * pango/pangowin32-private.h: Add pango_win32_os_version_info variable, an OSVERSIONINFO struct. * pango/pangowin32.c: Initialise it. * pango/pangowin32.h: Set _WIN32_WINNT to 0x0501 before including <windows.h> to get the ClearType-related macros defined (if recent enough headers are used). * pango/pangowin32-fontcache.c (pango_win32_font_cache_load): Set desired font quality to CLEARTYPE_QUALITY if on XP (or later), and the system settings ask for ClearType.
Diffstat (limited to 'pango/pangowin32-fontcache.c')
-rw-r--r--pango/pangowin32-fontcache.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/pango/pangowin32-fontcache.c b/pango/pangowin32-fontcache.c
index f05d341c..6dd87c5b 100644
--- a/pango/pangowin32-fontcache.c
+++ b/pango/pangowin32-fontcache.c
@@ -184,10 +184,37 @@ pango_win32_font_cache_load (PangoWin32FontCache *cache,
}
else
{
- BOOL aa;
+ BOOL font_smoothing;
lf = *lfp;
- SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &aa, 0);
- lf.lfQuality = (aa ? ANTIALIASED_QUALITY : DEFAULT_QUALITY);
+ SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &font_smoothing, 0);
+ /* If on XP or better, try to use ClearType if the global system
+ * settings ask for it.
+ */
+ if (font_smoothing &&
+ (pango_win32_os_version_info.dwMajorVersion > 5 ||
+ (pango_win32_os_version_info.dwMajorVersion == 5 &&
+ pango_win32_os_version_info.dwMinorVersion >= 1)))
+ {
+ UINT smoothing_type;
+
+#ifndef SPI_GETFONTSMOOTHINGTYPE
+#define SPI_GETFONTSMOOTHINGTYPE 0x200a
+#endif
+#ifndef FE_FONTSMOOTHINGCLEARTYPE
+#define FE_FONTSMOOTHINGCLEARTYPE 2
+#endif
+#ifndef CLEARTYPE_QUALITY
+#define CLEARTYPE_QUALITY 5
+#endif
+ SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0);
+ lf.lfQuality =
+ (font_smoothing ?
+ (smoothing_type == FE_FONTSMOOTHINGCLEARTYPE ?
+ CLEARTYPE_QUALITY : ANTIALIASED_QUALITY) :
+ DEFAULT_QUALITY);
+ }
+ else
+ lf.lfQuality = (font_smoothing ? ANTIALIASED_QUALITY : DEFAULT_QUALITY);
lf.lfCharSet = DEFAULT_CHARSET;
for (tries = 0; ; tries++)
{