Ambiguous width character incorrectly sized when UseDx enabled in conhost #6463

Open
opened 2026-01-31 00:39:25 +00:00 by claunia · 0 comments
Owner

Originally created by @j4james on GitHub (Feb 15, 2020).

Environment

Windows build number: Version 10.0.18362.535
Windows Terminal version (if applicable): n/a
Conhost built from commit 4634a68a9b

Steps to reproduce

  1. Set the UseDx registry entry to 1
  2. Open a WSL bash shell in conhost
  3. Run the command printf "12\n\uFFFD\n"

Expected behavior

U+FFFD is an ambiguous width character, which I thought we were supposed to be interpreting as narrow (see PR #2928). It certainly seems to work that way in Windows Terminal.

image

Actual behavior

In conhost (when UseDx is enabled), ambiguous width characters appear to be dependent on the font, so on my system this character is being rendered over two columns as if it were a wide character.

image

Looking at PR #2928, I see we made the glyph width fallback method in TermControl.cpp return false for all values. If I do something similar for the SetGlyphWidthFallback call in srvinit.cpp, that fixes the problem. Is there a reason why we don't want to do that? Are there backwards compatibility issues?

Originally created by @j4james on GitHub (Feb 15, 2020). # Environment Windows build number: Version 10.0.18362.535 Windows Terminal version (if applicable): n/a Conhost built from commit 4634a68a9bbedd860f62cca5748d36c79afb1f82 # Steps to reproduce 1. Set the _UseDx_ registry entry to 1 2. Open a WSL bash shell in conhost 3. Run the command `printf "12\n\uFFFD\n"` # Expected behavior `U+FFFD` is an ambiguous width character, which I thought we were supposed to be interpreting as narrow (see PR #2928). It certainly seems to work that way in Windows Terminal. ![image](https://user-images.githubusercontent.com/4181424/74591836-37439c80-5013-11ea-9207-a8a69eb90450.png) # Actual behavior In conhost (when _UseDx_ is enabled), ambiguous width characters appear to be dependent on the font, so on my system this character is being rendered over two columns as if it were a wide character. ![image](https://user-images.githubusercontent.com/4181424/74591847-52aea780-5013-11ea-88dd-088e553f6ca8.png) Looking at PR #2928, I see we made the glyph width fallback method in [_TermControl.cpp_](https://github.com/microsoft/terminal/blob/38ebf48d79f65d6460451e1b4ff5c5f6f010d9b9/src/cascadia/TerminalControl/TermControl.cpp#L29-L46) return false for all values. If I do something similar for the `SetGlyphWidthFallback` call in [_srvinit.cpp_](https://github.com/microsoft/terminal/blob/a13ccfd0f5c1a63ba602d78afba72ab3abaabf34/src/host/srvinit.cpp#L550-L553), that fixes the problem. Is there a reason why we don't want to do that? Are there backwards compatibility issues?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6463