I created a very simple c++ win32
application, and I'm trying to draw some text using the following font settings:
charset = OEM_CHARSET
pitch = FIXED_PITCH
name = L"System"
I create the font like this:
CreateFont(16, 0, 0, 0, FW_REGULAR, false, false, false, OEM_CHARSET, OUT_RASTER_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, L"System");
and I draw the text in WM_PAINT
like this:
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
SelectObject(hdc, font);
TextOut(hdc, 100, 200, L"wiw", 3);
EndPaint(hWnd, &ps);
However, the text that is drawn is in the Consolas
font, not the System
font.
The thing is, if I change OEM_CHARSET
to DEFAULT_CHARSET
, then the text is drawn using the correct font System
.
Here is the text drawn with OEM_CHARSET
(ie not working):
Here is the text drawn without OEM_CHARSET
(ie working, but I need OEM_CHARSET
set):
The reason I need OEM_CHARSET
set is because I'm attempting to replicate this, and the answer states that OEM_CHARSET
, FIXED_PITCH
and System
are required.
My questions are:
- Why does
OEM_CHARSET
renderSystem
font with a different font altogether? - What does
OEM_CHARSET
even do? The documentation just states it maps the characters differently, but I'm using plainascii
, so why would that matter? - Does my version of windows matter? I'm using
Windows 10 x64
.