summaryrefslogtreecommitdiff
path: root/src/os/windows/font_win32.cpp
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2021-05-14 15:26:03 +0200
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-06-10 23:17:29 +0200
commit744a9e474575af90935807620bff860c02559d76 (patch)
tree1c9dc114fb609d12cc9faffd16e88f177696dd13 /src/os/windows/font_win32.cpp
parent15f66329c28cb0aa3107dbb8da71281b1501be6b (diff)
downloadopenttd-744a9e474575af90935807620bff860c02559d76.tar.xz
Codechange: [WIN32] Add a wrapper around GetProcAddress()
Diffstat (limited to 'src/os/windows/font_win32.cpp')
-rw-r--r--src/os/windows/font_win32.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp
index 6c4e67deb..956e4a85c 100644
--- a/src/os/windows/font_win32.cpp
+++ b/src/os/windows/font_win32.cpp
@@ -620,8 +620,9 @@ void LoadWin32Font(FontSize fs)
if (AddFontResourceEx(fontPath, FR_PRIVATE, 0) != 0) {
/* Try a nice little undocumented function first for getting the internal font name.
* Some documentation is found at: http://www.undocprint.org/winspool/getfontresourceinfo */
+ static DllLoader _gdi32(L"gdi32.dll");
typedef BOOL(WINAPI *PFNGETFONTRESOURCEINFO)(LPCTSTR, LPDWORD, LPVOID, DWORD);
- static PFNGETFONTRESOURCEINFO GetFontResourceInfo = (PFNGETFONTRESOURCEINFO)GetProcAddress(GetModuleHandle(L"Gdi32"), "GetFontResourceInfoW");
+ static PFNGETFONTRESOURCEINFO GetFontResourceInfo = _gdi32.GetProcAddress("GetFontResourceInfoW");
if (GetFontResourceInfo != nullptr) {
/* Try to query an array of LOGFONTs that describe the file. */