From c5f5899f208689a6d414c2a51effa84e05560aad Mon Sep 17 00:00:00 2001 From: lifegpc Date: Tue, 11 Mar 2025 13:39:04 +0800 Subject: [PATCH] fix font handle --- dllmain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dllmain.cpp b/dllmain.cpp index be996ba..6fdacd9 100644 --- a/dllmain.cpp +++ b/dllmain.cpp @@ -74,7 +74,7 @@ static PVOID h = nullptr; HFONT WINAPI HookedCreateFontW(int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, DWORD dwItalic, DWORD dwUnderline, DWORD dwStrikeOut, DWORD dwCharSet, DWORD dwOutPrecision, DWORD dwClipPrecision, DWORD dwQuality, DWORD dwPitchAndFamily, LPCWSTR lpFaceName) { std::wstring name(lpFaceName); - if (name == L"Meiryo") { + if (name == L"MS Gothic" || name == L"MS ゴシック") { lpFaceName = defaultFont.c_str(); } return TrueCreateFontW(nHeight, nWidth, nEscapement, nOrientation, fnWeight, dwItalic, dwUnderline, dwStrikeOut, dwCharSet, dwOutPrecision, dwClipPrecision, dwQuality, dwPitchAndFamily, lpFaceName); @@ -85,13 +85,13 @@ HFONT WINAPI HookedCreateFontA(int nHeight, int nWidth, int nEscapement, int nOr std::wstring font; for (int i = 0; i < 4; i++) { if (wchar_util::str_to_wstr(font, lpFaceName, cp[i])) { - if (font == L"Meiryo") { + if (font == L"MS Gothic" || font == L"MS ゴシック") { font = defaultFont; } return TrueCreateFontW(nHeight, nWidth, nEscapement, nOrientation, fnWeight, dwItalic, dwUnderline, dwStrikeOut, dwCharSet, dwOutPrecision, dwClipPrecision, dwQuality, dwPitchAndFamily, font.c_str()); } } - if (!strcmp(lpFaceName, "Meiryo")) { + if (!strcmp(lpFaceName, "MS Gothic")) { lpFaceName = "Microsoft YaHei"; } return TrueCreateFontA(nHeight, nWidth, nEscapement, nOrientation, fnWeight, dwItalic, dwUnderline, dwStrikeOut, dwCharSet, dwOutPrecision, dwClipPrecision, dwQuality, dwPitchAndFamily, lpFaceName);