[PR #17681] Remove CHAR_INFO munging for raster fonts #31326

Open
opened 2026-01-31 09:46:35 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/17681

State: closed
Merged: Yes


RealUnicodeToFalseUnicode was described as:

This routine converts a unicode string into the correct characters
for an OEM (cp 437) font. This code is needed because the gdi glyph
mapper converts unicode to ansi using codepage 1252 to index font.
This is how the data is stored internally.

In other words, it takes a UCS2 string, translates it to the current
codepage and translates it back to UCS2 in the US version of Windows.
In the "eastern" DBCS version it "reinterprets" the DBCS string as
CP_USA (a particularly weird quirk).

The original implementation used to do this translation at every
opportunity where text went into or out of conhost.
The translation was weird, but it was consistent.
In Windows 10 RS1 conhost got a new UCS2-aware text buffer and
this translation was removed from most places, as the text buffer
was converted to store proper UCS2. This broke the entire concept
of the translation though. Whatever data you previously wrote with
something like WriteConsoleOutputCharacter now came back with
something entirely else via ReadConsoleOutput.

In other words, I believe past RS1 there was technically never any
point in "munging" CHAR_INFOs, as this only covered 2 API functions.

Still, this does mean that this PR represents an API breaking change.
It's a minor one though, because it only affects 2 API functions.
And more importantly, it's a necessary breaking change as we move
further and further away from correlating codepoint and column counts.

Validation Steps Performed

  • Remaining tests pass
**Original Pull Request:** https://github.com/microsoft/terminal/pull/17681 **State:** closed **Merged:** Yes --- `RealUnicodeToFalseUnicode` was described as: > This routine converts a unicode string into the correct characters > for an OEM (cp 437) font. This code is needed because the gdi glyph > mapper converts unicode to ansi using codepage 1252 to index font. > This is how the data is stored internally. In other words, it takes a UCS2 string, translates it to the current codepage and translates it back to UCS2 in the US version of Windows. In the "eastern" DBCS version it "reinterprets" the DBCS string as `CP_USA` (a particularly weird quirk). The original implementation used to do this translation at every opportunity where text went into or out of conhost. The translation was weird, but it was consistent. In Windows 10 RS1 conhost got a new UCS2-aware text buffer and this translation was removed from most places, as the text buffer was converted to store proper UCS2. This broke the entire concept of the translation though. Whatever data you previously wrote with something like `WriteConsoleOutputCharacter` now came back with something entirely else via `ReadConsoleOutput`. In other words, I believe past RS1 there was technically never any point in "munging" `CHAR_INFO`s, as this only covered 2 API functions. Still, this does mean that this PR represents an API breaking change. It's a minor one though, because it only affects 2 API functions. And more importantly, it's a necessary breaking change as we move further and further away from correlating codepoint and column counts. ## Validation Steps Performed * Remaining tests pass ✅
claunia added the pull-request label 2026-01-31 09:46:35 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31326