Skip to content

Treat emoji + VS16 sequences as double-width - #5262

Open
xhon-pelushi wants to merge 1 commit into
termux:masterfrom
xhon-pelushi:emoji-vs16-double-width
Open

Treat emoji + VS16 sequences as double-width#5262
xhon-pelushi wants to merge 1 commit into
termux:masterfrom
xhon-pelushi:emoji-vs16-double-width

Conversation

@xhon-pelushi

@xhon-pelushi xhon-pelushi commented Aug 15, 2026

Copy link
Copy Markdown

Summary

  • Report width 2 for Emoji=Yes / Emoji_Presentation=No bases when immediately followed by U+FE0F.
  • Update terminal row/emulator/renderer bookkeeping so ❤︎-style sequences stop rendering half-width.

Fixes #5251

Test plan

  • ./gradlew :terminal-emulator:test (139 tests, including new VS16 cases)
  • terminal-view compile
  • Visual check of ❤︎ / 🗡︎ / 🗺︎ in a Termux session

Some emojis, such as U+2764 ❤ (HEAVY BLACK HEART), U+1F5E1 🗡
(DAGGER KNIFE) and U+1F5FA 🗺 (WORLD MAP), are narrow by default
(Emoji_Presentation=No) and only take on their double-width emoji
form when immediately followed by U+FE0F VARIATION SELECTOR-16.
WcWidth previously ignored this context and always reported them as
width 1, so TerminalRenderer's font-width-mismatch correction would
scale the naturally wide glyph down to fit a single narrow cell,
producing the reported squished rendering.

WcWidth gains a table of the 219 code points with Emoji=Yes but
Emoji_Presentation=No (derived from Unicode 15's emoji-data.txt) and
a lookahead-aware width(chars, index[, limit]) that reports width 2
for one of these code points immediately followed by
VARIATION_SELECTOR_16. TerminalRow#setChar widens the column for
such a sequence instead of treating the selector as an ordinary
zero-width combining mark, and TerminalEmulator advances the cursor
to match. TerminalRenderer measures the selector along with its base
character so the glyph's natural width is detected and no longer
scaled down.

Fixes termux#5251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Some emojis with U+FE0F VARIATION SELECTOR-16 render at half the correct width

1 participant