[pango/pango2-windows: 73/77] pangodwrite-fontmap.cpp: Set up DirectWrite GDI interop
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2-windows: 73/77] pangodwrite-fontmap.cpp: Set up DirectWrite GDI interop
- Date: Wed, 6 Jul 2022 03:02:39 +0000 (UTC)
commit c2cd26f0a11870cc65f5f86441cb49687ed9b4c2
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Jul 4 11:43:14 2022 +0800
pangodwrite-fontmap.cpp: Set up DirectWrite GDI interop
This makes our DirectWrite fontmap object to set up GDI interop, since there
are times when we still need to deal with GDI LOGFONTW objects, such as when we
query the system fonts via SystemParametersInfoW() where the returned Windows
font object is a LOGFONTW.
pango2/pangodwrite-fontmap.cpp | 15 +++++++++++++++
1 file changed, 15 insertions(+)
---
diff --git a/pango2/pangodwrite-fontmap.cpp b/pango2/pangodwrite-fontmap.cpp
index 7f4ead157..6fa51c240 100644
--- a/pango2/pangodwrite-fontmap.cpp
+++ b/pango2/pangodwrite-fontmap.cpp
@@ -56,6 +56,7 @@ struct _Pango2DirectWriteFontMap
Pango2FontMap parent_instance;
IDWriteFactory *dwrite_factory;
+ IDWriteGdiInterop *gdi_interop;
};
struct _Pango2DirectWriteFontMapClass
@@ -352,6 +353,14 @@ pango2_direct_write_font_map_init (Pango2DirectWriteFontMap *self)
if (FAILED (hr) || !self->dwrite_factory)
g_error ("DWriteCreateFactory failed with error code %x", (unsigned)hr);
+ if (self->dwrite_factory)
+ {
+ hr = self->dwrite_factory->GetGdiInterop (&self->gdi_interop);
+
+ if (FAILED (hr) || !self->gdi_interop)
+ g_error ("GdiInterop failed with error code %x", (unsigned)hr);
+ }
+
pango2_font_map_repopulate (PANGO2_FONT_MAP (self), TRUE);
}
@@ -360,6 +369,12 @@ pango2_direct_write_font_map_finalize (GObject *object)
{
Pango2DirectWriteFontMap *dwrite_map = PANGO2_DIRECT_WRITE_FONT_MAP (object);
+ if (dwrite_map->gdi_interop != NULL)
+ {
+ dwrite_map->gdi_interop->Release ();
+ dwrite_map->gdi_interop = NULL;
+ }
+
dwrite_map->dwrite_factory->Release ();
dwrite_map->dwrite_factory = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]