Skip to content

Commit b7fc0f2

Browse files
authored
Replace PolyTextOutW with ExtTextOutW (#10478)
Replace PolyTextOutW with ExtTextOutW to allow substitution of missing glyphs from other fonts. Why not let Windows substitute the glyphs that are missing in the current font? Currently the GDI renderer of conhost/OpenConsole uses `PolyTextOutW` for drawing. `PolyTextOutW` doesn't try to substitute any missing glyphs, so the only way to see, say, Hiragana is to change the _whole font_ to something like MS Gothic (which is eye-bleeding, to be honest). A trivial replace `PolyTextOutW` -> `ExtTextOutW` does the trick. Switch to `PolyTextOutW` happened in Windows 7 along with introduction of conhost.exe. Substitution worked in previous Windows versions, where internal NT interfaces were used. # Before the change: ![image](https://user-images.githubusercontent.com/11453922/122759189-93ff3900-d291-11eb-89a9-b1d47aa22ed9.png) # After the change: ![image](https://user-images.githubusercontent.com/11453922/122759316-b4c78e80-d291-11eb-87aa-7cdc2979ae28.png) Closes #10472
1 parent 2770228 commit b7fc0f2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/renderer/gdi/paint.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,14 @@ using namespace Microsoft::Console::Render;
436436

437437
if (_cPolyText > 0)
438438
{
439-
if (!PolyTextOutW(_hdcMemoryContext, _pPolyText, (UINT)_cPolyText))
439+
for (size_t i = 0; i != _cPolyText; ++i)
440440
{
441-
hr = E_FAIL;
441+
const auto& t = _pPolyText[i];
442+
if (!ExtTextOutW(_hdcMemoryContext, t.x, t.y, t.uiFlags, &t.rcl, t.lpstr, t.n, t.pdx))
443+
{
444+
hr = E_FAIL;
445+
break;
446+
}
442447
}
443448

444449
_polyStrings.clear();

0 commit comments

Comments
 (0)