mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-14 13:58:04 +01:00
Use a single Unicode charset and specify language-specific font for better viewing (?) (#69)
* Use a single Unicode charset and specify language-specific font for better (?) viewing * Fix missing include for strcpy_s function * Better (?) implementation of using strings (so that font names aren't limited to 30 chars)
This commit is contained in:
parent
09c62f5909
commit
3c2fff9d07
1 changed files with 9 additions and 13 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "options.h"
|
||||
#include "pinball.h"
|
||||
#include "winmain.h"
|
||||
#include <string>
|
||||
|
||||
HPALETTE gdrv::palette_handle = nullptr;
|
||||
HINSTANCE gdrv::hinst;
|
||||
|
@ -446,29 +447,24 @@ void gdrv::grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width,
|
|||
sscanf_s(fontColor, "%d %d %d", &grtext_red, &grtext_green, &grtext_blue);
|
||||
}
|
||||
|
||||
// DEFAULT_CHARSET in unicode build.
|
||||
int charset;
|
||||
std::string font;
|
||||
switch (options::Options.Language)
|
||||
{
|
||||
default:
|
||||
case Languages::English:
|
||||
charset = ANSI_CHARSET;
|
||||
break;
|
||||
case Languages::Russian:
|
||||
charset = RUSSIAN_CHARSET;
|
||||
break;
|
||||
case Languages::TraditionalChinese:
|
||||
charset = CHINESEBIG5_CHARSET;
|
||||
font = "Microsoft JhengHei";
|
||||
break;
|
||||
case Languages::SimplifiedChinese:
|
||||
charset = GB2312_CHARSET;
|
||||
font = "Microsoft YaHei";
|
||||
break;
|
||||
default:
|
||||
font = "Arial";
|
||||
}
|
||||
|
||||
// DEFAULT_CHARSET in unicode build.
|
||||
// Default font does not scale well
|
||||
auto hNewFont = CreateFont(fontSize, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
||||
charset, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||
DEFAULT_PITCH | FF_SWISS, "Arial");
|
||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||
DEFAULT_PITCH | FF_SWISS, font.c_str());
|
||||
HFONT hOldFont = static_cast<HFONT>(SelectObject(dc, hNewFont));
|
||||
int prevMode = SetBkMode(dc, TRANSPARENT);
|
||||
COLORREF color = SetTextColor(dc, grtext_red | grtext_green << 8 | grtext_blue << 16);
|
||||
|
|
Loading…
Reference in a new issue