Repository navigation
macOS: one surface renders CJK as wrong glyphs from the same face until the font size changes (1.4.0, Metal) #15018
Replies: 10 comments
|
Same symptom here with Japanese on macOS 26 (Darwin 25.6), Ghostty 1.4.0, three times so far. I think I found where the glyph IDs from the wrong font come from: the CoreText shaper's font cache is keyed only by the address of the In my case it happens after waking the Mac from a long sleep during which the display configuration changed. The wrong glyphs are glyph IDs of one fallback face drawn with another fallback face, the same pattern as in the Korean comment above:
The first row is what I saw today, the second row is an earlier occurrence. So the shaper and the rasterizer disagree about which face a How I think this happens (from reading v1.4.0):
So the sequence would be: the shaper last saw grid A → while the surface is hidden, the DPI changes, grid B replaces A and A is freed → the DPI changes back and grid C is allocated at A's old address → the surface becomes visible, This also fits the other observations: only the affected surface is broken (each renderer has its own shaper), a new tab is fine (fresh shaper), and What I have not verified: I have not seen the address reuse directly, since the release build does not log grid addresses. I also don't know if the original report followed the same path. It mentions no sleep, but a hidden tab plus a font grid change would also skip shaping. A possible fix is to reset the shaper's font cache in AI disclosure: I used Claude Code to read the Ghostty source, compare glyph IDs with CoreText, and draft this comment. I reviewed it, and the observations are from my own machine. |
|
Same here on a tip build, so this predates 1.4.0: The broken characters are all fallback glyphs from Claude Code's UI: What I can add:
|
|
I'm hitting the same issue on Ghostty 1.4.0 (stable), so it still reproduces on the latest release. Symptom: after a long-running TUI (Claude Code) prints a lot of Chinese text, newly rendered CJK characters are drawn with unrelated glyphs, one-for-one ("结论" → "佻前", "另一个问题" → "噝ブミ他佝"). ASCII and color emoji stay correct. Some symbols are affected too: Workaround:
Environment:
|
|
Same symptom here with Japanese and symbols such as Repro on my machine: Retina built-in display plus a non-Retina external display, Ghostty window on the external one, sleep, wake. With v1.4.0 plus logging (ReleaseFast) the text was garbled on 3 of 3 wakes: The Possible fix, with a regression test: orion0616@4417386. It gives each AI disclosure: Claude Code assisted with the analysis, the fix, the test and this comment, and Codex reviewed them. I read the relevant code and the fix, and the observations are from my own machine. |
|
Same symptom on a newer OS, plus one extra data point on the recovery path. Environment: Ghostty 1.4.0 (official notarized build), macOS 27.2.1 (26B131), arm64, single 5120×2880@2x display, default config (built-in JetBrains Mono + system PingFang SC fallback), no font/theme overrides. Hit it in a long-lived Claude Code tab, process uptime ~1 day 4 h. 1.
So three different "force the font state to be rebuilt" operations all fix an already-corrupted surface: font-size change, config reload, and (per earlier comments) a new surface. That seems consistent with the stale 2. It can happen without any display reconfiguration. Some reports above correlate this with sleep/wake and Retina↔non-Retina display changes. My machine has exactly one display, no external monitor, and I'm not aware of any display or DPI change around the event — so if address reuse is the trigger, I'd rather not post my session contents, but I can reproduce the same before/after pair with dummy output if a screenshot is useful. Also happy to run a build with extra font-cache / grid-address logging to help confirm the reuse hypothesis. |
|
Same symptom here with symbols rather than CJK, on Ghostty 1.4.0, with one extra data point: pinning the affected codepoints with Environment: Ghostty 1.4.0 stable ( What breaks: only symbols JetBrains Mono has no glyph for, so they come from fallback fonts. Glyphs in JetBrains Mono itself are always fine.
Observations:
Workaround: I have screenshots of the broken and correct states if they would help. AI disclosure: I used Claude Code to check the bytes and glyph IDs, test the |
|
Same thing here with a default config (no font settings at all). It's the same face pair as in the original report: Songti SC glyph IDs drawn with PingFang SC. Even the comma matches: Environment: Ghostty 1.4.0, macOS 27.2.1 (26B131), Apple M2. Built-in Retina display (2560×1664, 2x) plus an external 2560×1440 monitor at 1x, the same mixed-DPI setup as in orion0616's repro. The Ghostty process had been running for about 5 days. Affected tab: Claude Code, mostly Simplified Chinese output. All 18 characters of one garbled line follow the pattern. hb-shape outputThe first line is what was written, the second is what was displayed. Songti SC Regular/Light/Bold and STSong share this glyph order, and so do all PingFang SC weights. Timing, in case it helps:
AI disclosure: Claude Code did the glyph-ID matching and log checks and drafted this comment. I reviewed it before posting. |
|
A fix was merged in PR #15280. It's scheduled to be included in 1.5.0. It's already in the tip (nightly) build. AI disclosure: I wrote this in Japanese and translated it with DeepL. |



Uh oh!
There was an error while loading. Please reload this page.
Issue Description
After a long-running, CJK-heavy TUI session (Claude Code, hours of Chinese output), one surface starts rendering every CJK character as a different, but complete and valid, glyph. ASCII is unaffected. The substitution is deterministic per codepoint and cell widths are preserved:
Observations that point at the renderer, not the byte stream or font fallback:
printf '的在里以出\n'in the same surface displaysピホ?㎏㏄, and the echoed command line is garbled the same way.Cmd+=) fixes it in place, including all existing scrollback: the same cells, unchanged, immediately re-render as correct Chinese.Cmd+0afterwards stays correct.ghostty +show-facereports that all of the source codepoints and all of the substituted glyphs come from the same face (PingFang SC), so this is not a wrong-fallback-face case like CJK characters not rendering properly #9410. The displayed glyphs are not a constant glyph-ID offset from the correct ones in that face either.This looks like the affected surface's GPU glyph atlas texture (or the cached atlas coordinates for its cells) falling out of sync with the shared font grid's atlas, presumably after an atlas grow/modify while many new CJK glyphs were being rasterized. A font size change creates a fresh grid/atlas for the surface, which would explain why it recovers.
Possibly related: #14944 (also 1.4.0, fallback glyphs corrupted after heavy redraws in Claude Code, but there the symptom is enlarged/bold glyphs and it is process-wide).
AI disclosure: I used Claude Code to compare the garbled output against the original text, check glyph IDs with fontTools, and draft this report. I reviewed it before posting, and the observations above are from my own machine.
Expected Behavior
Each cell renders the glyph for its own codepoint, and a surface does not get stuck rendering glyphs from the wrong atlas regions.
Actual Behavior
One surface renders all CJK codepoints as other glyphs from the same face (table above) until its font size is changed. ASCII and other surfaces are unaffected.
Reproduction Steps
I do not have a deterministic reproduction yet. It has happened several times, always in a single long-lived tab that has rendered a large amount of distinct CJK text over hours (a Claude Code session whose output is mostly Simplified Chinese, running under a PTY wrapper that passes bytes through unchanged). Roughly:
font-codepoint-mapto PingFang SC, font-size 24, Retina display).Cmd+=restores it.I'm happy to capture a debug build log, a GPU frame capture, or any other diagnostics the next time it happens if you tell me what is most useful.
Ghostty Logs
Nothing relevant:
log show --predicate 'subsystem == "com.mitchellh.ghostty"'has no atlas, glyph, or font entries for the last day.Ghostty Version
OS Version Information
macOS 27.0.1 (26A434), Apple M5 Pro
Minimal Ghostty Configuration
Not yet reduced to a minimal config, because I cannot trigger it on demand. The font-related part of my config:
Additional Relevant Configuration
All reactions