Repository navigation
Ground-state UTF-8 paths treat C0 bytes 0x10-0x1F (except ESC) as printable text #14021
Issue DescriptionI started investigating with a font symptom. Despite no known software update or configuration change, after closing and reopening the lid on my MacBook I noticed that:
I have two findings after investigation:
I created this discussion primarily about how C0 controls are and should be handled. The mixed-font behavior is a downstream consequence showing that sending a C0 control into the printable-text path can do more then create a blank cell. The following is the full story of my investigation.
The next question was how DC4 handling related to the mixed-font rendering ?
How can an invisible control cause later Chinese text to use a font that was never configured?
Example screenshots for the mixed font issues from my reverse engineering:
Expected Behavior
The expected output from the minimal reproduction ( Actual Behavior
Reproduction StepsTo reproduce the printable nature of DC4
Only read the following if you are interested on reproducing the mixed-font issue. To reproduce a mixed-font reproduction
The script starts an isolated Ghostty instance that does not read the user's default configuration and uses only test-specific The test text maps the fullwidth Latin vowels and the second character of each Chinese pair explicitly to face B. The remaining characters have no explicit mapping and therefore encounter face A first in the Collection. On the affected parser, each line contains both A and B. Fullwidth Latin is used so that English-speaking maintainers can read the sample while it still bypasses the primary monospace face's ordinary ASCII coverage. #!/bin/sh
set -eu
render_trigger() {
if [ ! -t 1 ]; then
printf '%s\n' 'error: stdout must be a terminal' >&2
exit 2
fi
printf '\033[2J\033[H'
printf '\033]2;Ghostty C0 mixed-font trigger\007'
printf '%s\r\n' \
'DC4 MIXED-FONT TRIGGER' \
'Expected on affected parser: two fonts within each sample' \
'' \
'LATIN - sans vowels, serif consonants:'
printf '\024'
sleep 2
printf '\343\200\200'
sleep 2
printf '%s\r\n' 'AB EF IJ OP UV The Quick Brown Fox.'
printf '\r\n%s\r\n' 'CHINESE - serif first character, sans second character:'
printf '%s\r\n' '就开 看见 中文 字体'
printf '\r\n%s\r\n' 'Press Enter to close.'
IFS= read -r _ || :
}
if [ "${1-}" = "--render" ]; then
render_trigger
exit 0
fi
if [ "$#" -ne 0 ]; then
printf 'usage: sh %s\n' "$0" >&2
exit 2
fi
script_dir=$(CDPATH='' cd -P "$(dirname "$0")" && pwd)
script_path=$script_dir/$(basename "$0")
exec /usr/bin/open -n -a Ghostty.app --args \
--config-default-files=false \
--font-family=Menlo \
--font-size=24 \
'--font-codepoint-map=U+0014=Hiragino Mincho ProN' \
'--font-codepoint-map=U+10FFFF=Menlo' \
'--font-codepoint-map=U+3000=Hiragino Sans GB' \
'--font-codepoint-map=U+FF21,U+FF25,U+FF29,U+FF2F,U+FF35,U+FF41,U+FF45,U+FF49,U+FF4F,U+FF55=Hiragino Sans GB' \
'--font-codepoint-map=U+5F00,U+89C1,U+6587,U+4F53=Hiragino Sans GB' \
--confirm-close-surface=false \
-e /bin/sh "$script_path" --renderThe following is how I investigated and reproduced the issue and this is just for reference not a step that you need to follow Experiment 1: Wawati TC and CoreText I first tested whether DC4 would bring Wawati TC into the Collection when Wawati TC was visible in the Ghostty process's CoreText registry. In an isolated copy of the official Ghostty 1.3.1 app, I registered Wawati TC with CoreText process-scoped registration, then emitted DC4 followed by Chinese text. Ghostty's parser, resolver, Collection, shaper, and renderer remained unchanged. The registration only made Wawati TC visible to that process. A CLI probe saw 24
For This experiment reproduced the complete chain: DC4 is printed incorrectly -> font discovery runs for Experiment 2: Visual reproduction that can be attached to the Discussion To let other people see the same issue without depending on Wawati or the earlier CoreText state, I wrote the Shell script described in Reproduction Steps below. The script uses The two experiments use different constructions, but both reproduce the same chain. The Wawati experiment uses real CoreText fallback to reproduce the original font combination; the visual reproduction uses explicitly configured faces A and B to demonstrate the same mechanism reliably. Ghostty LogsNo response Ghostty VersionOS Version InformationmacOS 26.6.1 (Build 25G76), Apple Silicon (Linux only) Display ServerNone (Linux only) Desktop Environment/Window ManagerNo response Minimal Ghostty Configuration# I have no Ghostty config when I got the issue and when investigating.Additional Relevant ConfigurationNo response I acknowledge that:
|



#14022