East Asian font adjustments (#94)

* Disable input method in game

* Improve imm32.lib linking

* East Asian font size adjustments

* Use pre-defined font sizes instead of offset

* Use Malgun Gothic instead of Gulim for Korean
This commit is contained in:
Lim Chunwei 2021-11-19 13:25:46 +08:00 committed by GitHub
parent 129b8aac95
commit 818a90b7aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 5 deletions

View File

@ -436,12 +436,17 @@ void gdrv::grtext_draw_ttext_in_box(LPCWSTR text, int xOff, int yOff, int width,
22,
28
};
static const int fontSizes_EastAsian[3] =
{
22,
27,
32
};
xOff = static_cast<int>(xOff * fullscrn::ScaleX) + fullscrn::OffsetX;
yOff = static_cast<int>(yOff * fullscrn::ScaleY) + fullscrn::OffsetY;
width = static_cast<int>(width * fullscrn::ScaleX);
height = static_cast<int>(height * fullscrn::ScaleY);
auto fontSize = static_cast<int>(round(fontSizes[fullscrn::GetResolution()] * fullscrn::ScaleY));
HDC dc = GetDC(hwnd);
tagRECT rc{};
@ -459,25 +464,29 @@ void gdrv::grtext_draw_ttext_in_box(LPCWSTR text, int xOff, int yOff, int width,
sscanf_s(fontColor, "%d %d %d", &grtext_red, &grtext_green, &grtext_blue);
}
const char* font;
const char* font = "Arial";
const int* selectedFontSizes = fontSizes;
switch (options::Options.Language)
{
case Languages::TraditionalChinese:
font = "Microsoft JhengHei";
selectedFontSizes = fontSizes_EastAsian;
break;
case Languages::SimplifiedChinese:
font = "Microsoft YaHei";
selectedFontSizes = fontSizes_EastAsian;
break;
case Languages::Japanese:
font = "MS UI Gothic";
break;
case Languages::Korean:
font = "Gulim";
font = "Malgun Gothic";
selectedFontSizes = fontSizes_EastAsian;
break;
default:
font = "Arial";
}
auto fontSize = static_cast<int>(round(selectedFontSizes[fullscrn::GetResolution()] * fullscrn::ScaleY));
// Default font does not scale well
auto hNewFont = CreateFont(fontSize, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,