From c050fe202f1ef4657e64d48d363188240774f90f Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 14 Dec 2022 12:56:05 +0800 Subject: pangowin32-fontmap.c: Allow some support for loading custom fonts Previously, when using GDI, we are able to add custom fonts to the system font collection using AddFontResource()/AddFontResourceEx(), but this is not enough as we transition to DirectWrite. Allow some support for this for people that are using AddFontResource() (but not yet AddFontResourceEx()), by using the GDI interop support in DirectWrite. Let people know that currently AddFontResource() should be used for the moment for this support to work, not AddFontResourceEx(). --- pango/pangowin32-dwrite-fontmap.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pango/pangowin32-dwrite-fontmap.cpp') diff --git a/pango/pangowin32-dwrite-fontmap.cpp b/pango/pangowin32-dwrite-fontmap.cpp index a2c03675..377544a9 100644 --- a/pango/pangowin32-dwrite-fontmap.cpp +++ b/pango/pangowin32-dwrite-fontmap.cpp @@ -208,8 +208,12 @@ pango_win32_logfontw_get_dwrite_font (LOGFONTW *logfontw) hr = dwrite_items->gdi_interop->CreateFontFromLOGFONT (logfontw, &font); if (FAILED (hr) || font == NULL) - g_warning ("IDWriteFactory::GdiInterop::CreateFontFromLOGFONT failed with error %x\n", - (unsigned)hr); + { + g_warning ("IDWriteFactory::GdiInterop::CreateFontFromLOGFONT failed with error %x\n", + (unsigned)hr); + if (hr == DWRITE_E_NOFONT) + g_message ("Did you create your LOGFONTW using AddFontResource() instead of AddFontResourceEx()?"); + } return font; } -- cgit v1.2.1