Skip to content

Italic CJK (wide) glyphs take the next cell's foreground where they overhang: ligature-split threshold uses a 1-cell width #20890

Description

@conr2d

Windows Terminal version

1.24.12741.0

Windows build number

10.0.26300.9711

Other Software

  • Font: Harena Term K (https://github.com/harena-hq/harena-term-font/releases). It is a monospace font whose hangul spans about 0.98 of the 2-column advance. It has no italic face, so DirectWrite synthesizes the oblique.
  • Text renderer: AtlasEngine (default)
  • Shell: bash. The output is plain SGR, so the shell should not matter.

Steps to reproduce

  1. Set the profile font to a CJK monospace font with no italic face, e.g. Harena Term K.
  2. Run:
g() { printf '\e[90;3m%s\e[0m' "$1"; }
words() { local first=1; for w in "$@"; do [ $first = 1 ] || printf ' '; g "$w"; first=0; done; printf '\n'; }
s='오늘 회의에서 새 기능의 배포 일정을 정리했어요: 테스트는 내일 끝내고, 문서는 다음 주에 보내기로 했어요.'
words 오른쪽세로획 에 해 대 링 네 게 세 레 매 채   # 1: grey italic glyphs, default-colour spaces
g "$s"; printf '\n'                                   # 2: same sentence, spaces grey too
words $s                                              # 3: same sentence, default-colour spaces

Expected Behavior

Each italic glyph is drawn entirely in its own foreground (grey), including the part the slant pushes into the next column. This is what the comment above the split condition says it is for:

Ligatures are drawn with strict cell-wise foreground color, while other text allows colors to overhang their cells. This makes sure that italics and such retain their color and don't look "cut off".

Actual Behavior

Image

Where a glyph's top-right overhangs into the following cell, that sliver is painted in the following cell's foreground (white) instead of grey.

Measured on the capture above (10 px cells), counting runs of near-white pixels:

  • Line 1 has 11 slivers, line 2 has none, and line 3 has 12.
  • All 23 slivers start at the same x offset modulo the cell width (x ≡ 7 mod 10). The colour change follows the cell boundary, not the glyph outline.
  • Lines 2 and 3 are the same glyphs at the same slant. Only the next cell's foreground differs.

Cause

src/renderer/atlas/BackendD3D.cpp at 694db4c:

// L347
_ligatureOverhangTriggerRight = font.advanceWidth + halfCellWidth;
// L1562
const auto overlapSplit = rect.w >= p.s->font->cellSize.x && (bl <= triggerLeft || br >= triggerRight);
  • font.advanceWidth is the advance of '0', i.e. one cell (AtlasEngine.api.cpp L783-797).
  • bl/br are the black-box bounds relative to the glyph's own baseline origin (L1517-1519).
  • For a 2-column glyph, br >= 1.5 cells therefore holds as soon as its ink reaches the right half of its second column. That is true of essentially every CJK ideograph and hangul syllable, upright or italic.
  • The comment at L1556-1559 says this condition-pair is there to "exclude regular BMP wide glyphs that overlap a little". For wide glyphs, it excludes none of them.

Upright, this is invisible: both columns of a wide glyph share one foreground, so splitting them changes nothing. Once the glyph is italic and its ink crosses into a third column, _drawTextOverlapSplit paints that sliver with the third column's colour.

This is the same mechanism as #19033 and #16585. Those are narrow glyphs that overhang just enough to cross the threshold. Here, every wide glyph is past the threshold by construction.

Possible fix

  • Measure the trigger against the glyph's own column span rather than one cell. For a glyph occupying n columns, the right threshold is n * cellSize.x + halfCellWidth. A wide glyph is then split only if it overhangs its own columns by more than half a cell, as a narrow one is. Genuine multi-column ligatures still split.
  • One wrinkle: overlapSplit is cached per glyph index (L1566), while the column span depends on where the glyph lands in the row. So the decision either moves to draw time or the cache key gains the span.

Workaround

"font": { "features": { "liga": 0 } } disables the thresholds (L338-342). With it set, the script above renders lines 1 and 3 with no slivers. It only switches off the standard liga feature, so ligatures a font implements in calt are unaffected.

Activity

  1. added
    Issue-Bug
    Needs-Triage
    on Nov 5, 2026
  2. lhecker commented on Nov 5, 2026

    @lhecker
    Member

    Jeeyong Um (@conr2d) Your LLM already has all the context - can you ask it to send a PR? I give permission to ignore our AGENTS.md rules. Please ask your LLM to a) come up with an elegant way to integrate the fix (i.e. not just hotfix it) and b) to not test or verify the changes (I'll do that).

    Thanks for investigating this!

  3. added
    Area-Rendering
    Product-Terminal
    Priority-3
    and removed
    Needs-Triage
    on Nov 5, 2026
  4. added a commit that references this issue on Nov 10, 2026
    9a3f2a9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-AtlasEngineArea-RenderingIssue-BugPriority-3Product-Terminal

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions