ysc3839 / FontMod

Simple hook tool to change Win32 program font.
MIT License
1.29k stars 62 forks source link

MyGetStockObject 方法遗漏了 DEFAULT_GUI_FONT #77

Open yzy opened 2 years ago

yzy commented 2 years ago

jdk 的 jawt.dll 中使用 DEFAULT_GUI_FONT 检索默认字体,源码(awt_DesktopProperties.cpp)参考 :

            SetFontProperty(dc, ANSI_FIXED_FONT, TEXT("win.ansiFixed.font"), 1.0f);
            SetFontProperty(dc, ANSI_VAR_FONT, TEXT("win.ansiVar.font"), 1.0f);
            SetFontProperty(dc, DEVICE_DEFAULT_FONT, TEXT("win.deviceDefault.font"), 1.0f);
            SetFontProperty(dc, DEFAULT_GUI_FONT, TEXT("win.defaultGUI.font"), invScaleY);
            SetFontProperty(dc, OEM_FIXED_FONT, TEXT("win.oemFixed.font"), 1.0f);
            SetFontProperty(dc, SYSTEM_FONT, TEXT("win.system.font"), 1.0f);
            SetFontProperty(dc, SYSTEM_FIXED_FONT, TEXT("win.systemFixed.font"), 1.0f);

而 FontMod.cpp MyGetStockObject 方法中遗漏了此项,导致jdk中使用 FontMod 时开启 fixGSOFont 选项也没有效果。

HGDIOBJ WINAPI MyGetStockObject(int i)
{
    switch (i)
    {
    case OEM_FIXED_FONT:
    case ANSI_FIXED_FONT:
    case ANSI_VAR_FONT:
    case SYSTEM_FONT:
    case DEVICE_DEFAULT_FONT:
    case SYSTEM_FIXED_FONT:
        return newGSOFont;
    }
    return addrGetStockObject(i);
}