[directwrite] Link to library
Some checks failed
arm / arm-none-eabi (push) Waiting to run
configs-ci / build (push) Waiting to run
fontations / build (push) Waiting to run
linux-ci / build (push) Waiting to run
macos-ci / build (push) Waiting to run
msvc / msvc-2019-amd64 (push) Waiting to run
msvc / msvc-2019-x86 (push) Waiting to run
msys2 / MINGW32 (push) Waiting to run
msys2 / MINGW64 (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Failing after 0s

Instead of loading at runtime. I just want to see how CI deals with
this. Otherwise, not depending on dwrite is probably desired.
This commit is contained in:
Behdad Esfahbod 2025-03-22 02:48:29 -06:00 committed by Khaled Hosny
parent eda33efc88
commit b114518310
3 changed files with 8 additions and 23 deletions

View file

@ -332,12 +332,16 @@ if host_machine.system() == 'windows' and not get_option('gdi').disabled()
endif
endif
directwrite_dep = []
# DirectWrite (Windows)
if host_machine.system() == 'windows' and not get_option('directwrite').disabled()
if get_option('directwrite').enabled() and not cpp.has_header('dwrite_3.h')
error('DirectWrite was enabled explicitly, but required header is missing.')
endif
conf.set('HAVE_DIRECTWRITE', 1)
directwrite_dep = cpp.find_library('dwrite', required: get_option('directwrite'))
if directwrite_dep.found()
conf.set('HAVE_DIRECTWRITE', 1)
endif
endif
# CoreText (macOS)

View file

@ -188,25 +188,8 @@ struct hb_directwrite_global_t
{
hb_directwrite_global_t ()
{
dwrite_dll = LoadLibraryW (L"DWrite.dll");
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
t_DWriteCreateFactory p_DWriteCreateFactory = (t_DWriteCreateFactory)
GetProcAddress (dwrite_dll, "DWriteCreateFactory");
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
if (unlikely (!p_DWriteCreateFactory))
return;
HRESULT hr = p_DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory),
(IUnknown**) &dwriteFactory);
HRESULT hr = DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory),
(IUnknown**) &dwriteFactory);
if (unlikely (hr != S_OK))
return;
@ -222,12 +205,9 @@ struct hb_directwrite_global_t
fontFileLoader->Release ();
if (dwriteFactory)
dwriteFactory->Release ();
if (dwrite_dll)
FreeLibrary (dwrite_dll);
}
bool success = false;
HMODULE dwrite_dll;
IDWriteFactory *dwriteFactory;
DWriteFontFileLoader *fontFileLoader;
};

View file

@ -513,6 +513,7 @@ endif
if conf.get('HAVE_DIRECTWRITE', 0) == 1
hb_sources += hb_directwrite_sources
hb_headers += hb_directwrite_headers
harfbuzz_deps += directwrite_dep
# hb-directwrite needs a C++ linker
libharfbuzz_link_language = 'cpp'
endif