summaryrefslogtreecommitdiff
path: root/pango/pangowin32.c
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2022-07-21 14:53:42 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2022-09-26 11:04:25 +0800
commit902c839ab1725dac7e7a8a4ba2bf4b91c0cb1629 (patch)
treeac4f410447a58cbbc6c56b7d5e497daa85cc4b1e /pango/pangowin32.c
parentb406dd6e1282e7a98ed9a7b3d8b0e6af416a9797 (diff)
downloadpango-902c839ab1725dac7e7a8a4ba2bf4b91c0cb1629.tar.gz
PangoWin32: Implement is_hinted on Windows using DirectWrite
... by querying the font table 'gasp' and see whether the bits needed for hinting are there. Codewise, it is simpler with GDI+, but it would then require more overhead since GDI(+) operations are needed (this means "slower") and we need to put boilerplates for using GDI+ from our plain-C code.
Diffstat (limited to 'pango/pangowin32.c')
-rw-r--r--pango/pangowin32.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index 55a079c9..5a26ee98 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -56,6 +56,7 @@ static gboolean pango_win32_font_real_select_font (PangoFont *font,
HDC hdc);
static void pango_win32_font_real_done_font (PangoFont *font);
static double pango_win32_font_real_get_metrics_factor (PangoFont *font);
+static gboolean pango_win32_font_is_hinted (PangoFont *font);
static void pango_win32_get_item_properties (PangoItem *item,
PangoUnderline *uline,
@@ -202,6 +203,7 @@ _pango_win32_font_class_init (PangoWin32FontClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
PangoFontClass *font_class = PANGO_FONT_CLASS (class);
+ PangoFontClassPrivate *pclass;
object_class->finalize = pango_win32_font_finalize;
object_class->dispose = pango_win32_font_dispose;
@@ -218,6 +220,9 @@ _pango_win32_font_class_init (PangoWin32FontClass *class)
class->done_font = pango_win32_font_real_done_font;
class->get_metrics_factor = pango_win32_font_real_get_metrics_factor;
+ pclass = g_type_class_get_private ((GTypeClass *) class, PANGO_TYPE_FONT);
+ pclass->is_hinted = pango_win32_font_is_hinted;
+
_pango_win32_get_display_dc ();
}
@@ -662,6 +667,14 @@ pango_win32_font_real_get_metrics_factor (PangoFont *font)
return PANGO_SCALE;
}
+static gboolean
+pango_win32_font_is_hinted (PangoFont *font)
+{
+ g_return_val_if_fail (PANGO_WIN32_IS_FONT (font), FALSE);
+
+ return PANGO_WIN32_FONT (font)->is_hinted;
+}
+
/**
* pango_win32_font_logfont:
* @font: a `PangoFont` which must be from the Win32 backend