terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Some emoji not rendered correctly (e.g. keycaps)

Open david-macleod opened this issue 5 years ago • 17 comments

Windows Terminal version (or Windows build number)

1.6.10571.0

Other Software

Ubuntu 18.04.2 LTS

Steps to reproduce

Paste the following example characters into the terminal 🔟5️⃣

Expected behavior

image

Actual behavior

image or image

Apologies if this is a duplicate (I couldn't find anything obviously similar) but some emojis (e.g. keycap symbols (0-9)) are not rendered correctly using Ubuntu via Windows Terminal and was just wondering if I should expect this to work

david-macleod avatar Apr 05 '21 18:04 david-macleod

The reason the one works and the other doesn't is because keycap 10 has its own unique codepoint, while keycap 5 is actually multiple codepoints joined together (which isn't yet supported). I believe this is covered by issue #1472.

j4james avatar Apr 05 '21 21:04 j4james

You know what, I'm guessing this is some combo of #1472, #8000 and #190. Emoji work alright if they're being output by a client app, but they really, really don't work when they're being input (like, and a powershell prompt)

/dup #190 /dup #1472 /dup #8000

zadjii-msft avatar Apr 06 '21 10:04 zadjii-msft

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

ghost avatar Apr 06 '21 10:04 ghost

All of duplicated issues have been closed, but this issue has not been fixed yet.

tats-u avatar Sep 03 '25 14:09 tats-u

Can you post a screenshot of the issue you're seeing? I'm maintaining our text renderer so I may be able to help (or fix it).

lhecker avatar Sep 03 '25 16:09 lhecker

Image Image

↓Cascadia Mono

Image

tats-u avatar Sep 03 '25 23:09 tats-u

Those are keycap emojis which are a truly unique case among all emojis and are not well supported by Windows at all. Browsers are an exception since they (like us) implement their own text rendering. To support keycap emojis we need to add custom detection logic during MapCharacters (font fallback). That shouldn't be too difficult.

Is there anything else wrong?

lhecker avatar Sep 04 '25 00:09 lhecker

I think the remaining work well.

we need to add custom detection logic during MapCharacters (font fallback).

I see. We have only to detect the pattern in the above image showing their code points.

tats-u avatar Sep 04 '25 02:09 tats-u

Screenshot_20250904-114503.png

🔟 is an independent code point.

tats-u avatar Sep 04 '25 02:09 tats-u

Anyway I don't think there are any reasons to keep the status of this issue "resolved".

tats-u avatar Sep 04 '25 02:09 tats-u

Well, fine. 😶‍🌫️

lhecker avatar Sep 04 '25 17:09 lhecker

Can I add Flags to this? I know that Windows' Emoji font doesn't really do flags, but Windows Terminal does them worse by overlapping the two characters...

Image

Jaykul avatar Oct 11 '26 22:10 Jaykul

@Jaykul I believe the flag/regional indicators are now being tracked in #19744.

j4james avatar Oct 12 '26 19:10 j4james

Worth looking at #20790, I made 0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣#️⃣ work. Windows font fallback ignores U+FE0F and it sends U+20E3 to Segoe UI Symbol, which doesn't have a symbol for the glyph *, so as it stands it's still kinda ugly (still draws as two separate pieces).

@lhecker, I can leave it as is, or add like 15-20 new lines of code and maybe use Segoe UI emoji (or the user's own font emoji), which already handles emojis like 🔟.

Current main Image Before (as the PR stands). Image After (with Segoe UI Emoji) Image

Also, should the fix stay keycap emoji only? Or extend this to be wider U+FE0F handling, but that changes other emojis like ☺️ and ©️. Arrows and card suits would change too ⬅ ⬆ ▶ ♠ ♥

Criseda avatar Oct 12 '26 22:10 Criseda

@Criseda I currently lack time to properly think about this problem area. My early thoughts are:

  • The lack of removed lines in your PR makes me somewhat suspicious that it may not be well integrated just yet. I'll talk below about the ideal design. I do not mind merging a well-written hotfix, of course.
  • In general, you can use Chromium-based browsers as a reference for how Emojis should be drawn. This includes the U+FE0F handling. I believe your "After (with Segoe UI Emoji)" is how it should look like.

It may be worth noting the technically correct way for us to perform text shaping in AtlasEngine.cpp. The code currently looks somewhat like this:

Edit: Actually nvm! #20159 implements my idea already. It's described here: https://github.com/microsoft/terminal/pull/20159#discussion_r3162773222 I just need review #20159, then we can integrate your PR super easily. It's just not easy to merge #20159 because it's LLM generated, and very likely wrong in several aspects. I'll see what I can do!

lhecker avatar Oct 13 '26 11:10 lhecker

Thanks @lhecker, I've made my change easy to rebase in after #20159 (I'll keep an eye out to see what else changes). Chromium behaviour is all U+FE0F clusters using emoji font, which I've updated the PR to do. The code splits runs before font fallback in the same approach that #20159 does

Criseda avatar Oct 13 '26 13:10 Criseda

Confirming this from a downstream TUI application, where it is not just cosmetic.

Environment

  • Windows Terminal 1.24.12741.0, default font (Cascadia Mono), default font size
  • Windows 11, Windows PowerShell 5.1 and PowerShell 7 both affected
  • No font.face or rendering options configured

Reproduction outside any application

Windows PowerShell 5.1 does not support `u{...} escapes, so build the cluster from code points:

$k = { param($c) [string]::new([char[]]@($c, 0xFE0F, 0x20E3)) }
Write-Host "$(& $k 0x0031)  $(& $k 0x0032)  $(& $k 0x0023)  $(& $k 0x002A)"

Confirmed code points: U+0031 U+FE0F U+20E3 etc., three chars per cluster.

Result here: the leading character keeps its single-cell glyph and both combining marks degrade to tofu, i.e. the cluster is split across fonts rather than handed to the emoji font — the same behaviour described in this issue and targeted by #20790.

Why it matters beyond display

I maintain a ratatui-based terminal UI that renders markdown tables, so it shares your cell-grid contract. The grid assumes a keycap cluster occupies 2 cells — that is what unicode-width reports and what the TUI's own buffer records (symbol width == 2, next content starts 2 cells later). On screen the cluster does not occupy two whole cells, so the row's right border lands one cell off:

grid says (2 cells):   | 1️⃣ | x |
screen shows:          | 1🔲 | x |    <- everything after the cell shifts

Two observations that may help whoever picks up #20790:

  • The shift is frame-dependent. It does not follow a fixed width rule: the same cluster is aligned in one repaint and shifted in the next, and which rows look broken changes between repaints. Scrolling or selecting text changes the set of affected rows. That is why this is easy to mistake for an application bug.
  • There is no user-side workaround. font.fallback is not a real setting — I checked both defaults.json and profiles.schema.json shipped with 1.24 and neither contains the key, so adding it is silently ignored. Switching to a proportional emoji face would fix the glyph but break the monospace grid.

Tested clusters: U+002A, U+0031, U+0023 each followed by U+FE0F U+20E3. All identical.

Thanks for the 2026-10-13 analysis about fallback ignoring U+FE0F — it matches exactly what I see. If #20790 stops the cluster from being split during fallback, this case should be resolved as well.

署名

🤖 由 SpikeBot 000(CodeWhale-LOCAL) 生成

SparkofSpike avatar Nov 01 '26 01:11 SparkofSpike