summaryrefslogtreecommitdiff
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
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.
-rw-r--r--ChangeLog15
-rw-r--r--ChangeLog.pre-1-1015
-rw-r--r--ChangeLog.pre-1-215
-rw-r--r--ChangeLog.pre-1-415
-rw-r--r--ChangeLog.pre-1-615
-rw-r--r--ChangeLog.pre-1-815
-rw-r--r--pango/pangowin32-fontcache.c33
-rw-r--r--pango/pangowin32-private.h1
-rw-r--r--pango/pangowin32.c10
-rw-r--r--pango/pangowin32.h2
10 files changed, 132 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index bc170918..7e2819fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+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.
+
2002-03-16 Sven Neumann <sven@gimp.org>
* configure.in (GLIB_CFLAGS): use CFLAGS from gthread-2.0 to assure
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index bc170918..7e2819fa 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,18 @@
+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.
+
2002-03-16 Sven Neumann <sven@gimp.org>
* configure.in (GLIB_CFLAGS): use CFLAGS from gthread-2.0 to assure
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index bc170918..7e2819fa 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,18 @@
+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.
+
2002-03-16 Sven Neumann <sven@gimp.org>
* configure.in (GLIB_CFLAGS): use CFLAGS from gthread-2.0 to assure
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index bc170918..7e2819fa 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,18 @@
+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.
+
2002-03-16 Sven Neumann <sven@gimp.org>
* configure.in (GLIB_CFLAGS): use CFLAGS from gthread-2.0 to assure
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index bc170918..7e2819fa 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,18 @@
+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.
+
2002-03-16 Sven Neumann <sven@gimp.org>
* configure.in (GLIB_CFLAGS): use CFLAGS from gthread-2.0 to assure
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index bc170918..7e2819fa 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,18 @@
+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.
+
2002-03-16 Sven Neumann <sven@gimp.org>
* configure.in (GLIB_CFLAGS): use CFLAGS from gthread-2.0 to assure
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++)
{
diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h
index 8e3500f2..f0d21914 100644
--- a/pango/pangowin32-private.h
+++ b/pango/pangowin32-private.h
@@ -119,5 +119,6 @@ void pango_win32_fontmap_cache_remove (PangoFontMap *fontmap,
PangoWin32Font *xfont);
extern HDC pango_win32_hdc;
+extern OSVERSIONINFO pango_win32_os_version_info;
#endif /* __PANGOWIN32_PRIVATE_H__ */
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index 2ed7d555..ee0e14f8 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -40,6 +40,7 @@
#define PANGO_WIN32_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_WIN32_FONT, PangoWin32FontClass))
HDC pango_win32_hdc;
+OSVERSIONINFO pango_win32_os_version_info;
typedef struct _PangoWin32FontClass PangoWin32FontClass;
@@ -188,7 +189,14 @@ pango_win32_font_class_init (PangoWin32FontClass *class)
font_class->get_metrics = pango_win32_font_get_metrics;
if (pango_win32_hdc == NULL)
- pango_win32_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
+ {
+ pango_win32_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
+ memset (&pango_win32_os_version_info, 0,
+ sizeof (pango_win32_os_version_info));
+ pango_win32_os_version_info.dwOSVersionInfoSize =
+ sizeof (OSVERSIONINFO);
+ GetVersionEx (&pango_win32_os_version_info);
+ }
}
PangoWin32Font *
diff --git a/pango/pangowin32.h b/pango/pangowin32.h
index f060bdbb..fc5e0955 100644
--- a/pango/pangowin32.h
+++ b/pango/pangowin32.h
@@ -31,7 +31,9 @@
G_BEGIN_DECLS
#define STRICT
+#define _WIN32_WINNT 0x0501 /* To get ClearType-related macros */
#include <windows.h>
+#undef STRICT
#define PANGO_RENDER_TYPE_WIN32 "PangoRenderWin32"