diff options
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pangowin32-dwrite-fontmap.cpp | 25 | ||||
-rw-r--r-- | pango/pangowin32-fontmap.c | 8 | ||||
-rw-r--r-- | pango/pangowin32-private.h | 3 |
3 files changed, 33 insertions, 3 deletions
diff --git a/pango/pangowin32-dwrite-fontmap.cpp b/pango/pangowin32-dwrite-fontmap.cpp index 0a0278a9..dd2f506a 100644 --- a/pango/pangowin32-dwrite-fontmap.cpp +++ b/pango/pangowin32-dwrite-fontmap.cpp @@ -23,7 +23,7 @@ #include "config.h" #include <initguid.h> -#include <dwrite.h> +#include <dwrite_1.h> #ifdef STRICT #undef STRICT @@ -32,8 +32,10 @@ #ifdef _MSC_VER # define UUID_OF_IDWriteFactory __uuidof (IDWriteFactory) +# define UUID_OF_IDWriteFont1 __uuidof (IDWriteFont1) #else # define UUID_OF_IDWriteFactory IID_IDWriteFactory +# define UUID_OF_IDWriteFont1 IID_IDWriteFont1 #endif struct _PangoWin32DWriteItems @@ -181,6 +183,27 @@ pango_win32_logfontw_get_dwrite_font (LOGFONTW *logfontw) return font; } +gboolean +pango_win32_dwrite_font_is_monospace (gpointer dwrite_font, + gboolean *is_monospace) +{ + IDWriteFont *font = static_cast<IDWriteFont *>(dwrite_font); + IDWriteFont1 *font1 = NULL; + gboolean result = FALSE; + + if (SUCCEEDED (font->QueryInterface(UUID_OF_IDWriteFont1, + reinterpret_cast<void**>(&font1)))) + { + *is_monospace = font1->IsMonospacedFont (); + font1->Release (); + result = TRUE; + } + else + *is_monospace = FALSE; + + return result; +} + void pango_win32_dwrite_font_release (gpointer dwrite_font) { diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c index 9a140702..3756c929 100644 --- a/pango/pangowin32-fontmap.c +++ b/pango/pangowin32-fontmap.c @@ -1736,8 +1736,12 @@ pango_win32_insert_font (PangoWin32FontMap *win32fontmap, win32face->family = win32family = pango_win32_get_font_family (win32fontmap, pango_font_description_get_family (win32face->description)); - if ((lfp->lfPitchAndFamily & 0xF0) == FF_MODERN) - win32family->is_monospace = TRUE; + + if (!pango_win32_dwrite_font_is_monospace (dwrite_font, &win32family->is_monospace)) + { + if ((lfp->lfPitchAndFamily & 0xF0) == FF_MODERN) + win32family->is_monospace = TRUE; + } win32family->faces = g_slist_append (win32family->faces, win32face); diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h index 97bb6ba1..1d843ec2 100644 --- a/pango/pangowin32-private.h +++ b/pango/pangowin32-private.h @@ -302,6 +302,9 @@ void pango_win32_dwrite_font_map_populate (PangoWin32FontMap void pango_win32_dwrite_items_destroy (PangoWin32DWriteItems *items); +gboolean pango_win32_dwrite_font_is_monospace (gpointer dwrite_font, + gboolean *is_monospace); + void pango_win32_dwrite_font_release (gpointer dwrite_font); gpointer pango_win32_logfontw_get_dwrite_font (LOGFONTW *logfontw); |