Repository navigation
[Bug] Bold + extended foreground color + fallback CJK glyphs render as tofu boxes (AtlasEngine) #20788
Description
Description
A run of CJK text styled with bold (SGR 1) AND an extended foreground color (256-color 38;5;N or 24-bit 38;2;R;G;B), where the CJK glyphs are resolved from font fallback (primary font lacks CJK glyphs), renders as hollow tofu boxes (□). ASCII text in the same styled run renders fine, and related combinations (default fg + bold, extended color without bold, bold + RGB background, 16-color fg + bold) all render correctly.
Environment
- Windows Terminal: 1.24.12741.0 (stable, AtlasEngine)
- OS: Windows 11, zh-CN locale, console code page 65001 (UTF-8)
- Primary font: "MesloLGL Nerd Font" (contains no CJK glyphs; CJK resolves via fallback, e.g. Microsoft YaHei)
- Reproduced in plain Windows PowerShell 5.1 running inside Windows Terminal (no third-party TUI involved)
Steps to reproduce
Run the following in PowerShell inside Windows Terminal:
$e = [char]27
# OK - bold, default foreground
"$e[1m中文测试一二三$e[0m"
# OK - extended fg color, no bold
"$e[38;2;238;238;238m中文测试一二三$e[0m"
# OK - bold + RGB background
"$e[48;2;20;20;20m$e[1m中文测试一二三$e[0m"
# OK - 16-color fg + bold
"$e[1;33m中文测试一二三$e[0m"
# BROKEN - bold + 24-bit fg color, renders as tofu boxes
"$e[38;2;238;238;238m$e[1m中文测试一二三$e[0m"
# BROKEN - bold + 256-color fg color, renders as tofu boxes
"$e[38;5;253m$e[1m中文测试一二三$e[0m"Bisect matrix
| Case | foreground | background | bold | Result |
|---|---|---|---|---|
| L1 | default | default | yes | OK |
| L6 | RGB 38;2 | RGB 48;2 | no | OK |
| L7 | RGB 38;2 | default | no | OK |
| L8 | RGB 38;2 | default | yes | tofu boxes |
| L9 | default | RGB 48;2 | yes | OK |
| L10 | 256-color 38;5 | default | yes | tofu boxes |
| L11 | default | default | yes | OK |
| -- | 16-color (e.g. 33) | default | yes | OK |
Trigger = bold + extended foreground color + CJK glyph resolved from font fallback.
Expected behavior
The CJK characters render normally in all of the above cases.
Workaround (verified)
Adding a CJK font to the profile's font chain (multi-font face, WT 1.21+) resolves the issue:
"profiles": {
"defaults": {
"font": { "face": "MesloLGL Nerd Font, Microsoft YaHei" }
}
}With the chain set, all previously broken sequences render correctly.
Additional context
- The same program output renders correctly in xterm.js-based terminals (e.g. VS Code integrated terminal), and when the application takes a legacy 16-color rendering path, suggesting the defect is in the fallback/glyph-resolution path used for bold + extended-color runs.
- Real-world impact: TUI applications that style emphasized text with truecolor + bold (e.g. the opencode TUI on Windows) display all bold CJK text as boxes, which looks like a missing-glyph/font problem and misleads users into replacing their terminal font.
- Screenshots of the on-screen bisect matrix and before/after manifestations can be provided on request.
Activity