diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2022-07-04 11:43:14 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2022-08-01 18:23:33 +0800 |
commit | a4ed7a545f332822bd869a7ec509fa7cf8814ca3 (patch) | |
tree | 9215abbfec480ecb1e4e6e048f96c82fc9073a11 | |
parent | e27dc7a006ba68976c322c2189116f95ce6636d2 (diff) | |
download | pango-a4ed7a545f332822bd869a7ec509fa7cf8814ca3.tar.gz |
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.
-rw-r--r-- | pango2/pangodwrite-fontmap.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pango2/pangodwrite-fontmap.cpp b/pango2/pangodwrite-fontmap.cpp index 7f4ead15..6fa51c24 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; |