terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Unicode Pawn does not display like other Unicode chess symbols

Open paul-hansen opened this issue 3 years ago • 11 comments

Windows Terminal version

1.13.10984.0

Windows build number

10.0.22000.0

Other Software

No response

Steps to reproduce

Paste this Unicode character into your terminal ♟(U+265F) Source: https://en.wikipedia.org/wiki/Chess_symbols_in_Unicode

Expected Behavior

I expected it to match the current foreground color of the terminal similar to the other chess related Unicode symbols.

Actual Behavior

The pawn is always purple. Here's a screenshot of my chess game output in the windows terminal: image I can change the foreground color for all the other pieces using ANSI color codes but the pawn is always purple.

paul-hansen avatar May 16 '22 01:05 paul-hansen

a minimal repro

printf "White: \u2654 \u2655 \u2656 \u2657 \u2658 \u2659\nBlack: \u265a \u265b \u265c \u265d \u265e \u265f \n"

Looks like the black pawn is an emoji, when the others aren't.

I suspect this is because the chess characters aren't in Cascadia Code (or most fonts), dwrite looks up the glyph in some other font that does have it, and the emoji font shows up higher in the search list than wherever the other pieces are coming from. Hmm.

Might not be anything we can do here besides changing the font fallback order for glyphs (#2664)

zadjii-msft avatar May 16 '22 11:05 zadjii-msft

See also #6864, but like the opposite. The black bawn is "emoji yes, emoji-presentation no", so it shouldn't be rendered by dwrite as an emoji, but it is. Hmm.

zadjii-msft avatar May 16 '22 21:05 zadjii-msft

My understanding is that there are a number of glyphs that have both a text presentation and an emoji presentation, and you can use a variant selector to choose which style you want. They each have a default style though (when no variant selector is used), and in the case of the black pawn, the default style is meant to be text.

I'm sure I've seen a document somewhere that list all the default styles in a simple table, but the best I can find at the moment is this: https://www.unicode.org/emoji/charts/text-style.html

j4james avatar May 16 '22 21:05 j4james

I suspect this is because the chess characters aren't in Cascadia Code (or most fonts), dwrite looks up the glyph in some other font that does have it, and the emoji font shows up higher in the search list than wherever the other pieces are coming from.

That seems accurate, I confirmed it does use the font's symbol if you use a font that has the symbols. I found a font that has chess symbols using this page https://www.fontspace.com/unicode/char/265C-black-chess-rook image

The issue you linked would help a lot, enabling us to set it up the way we want on our own PCs. However it's not a great solution for if I wanted to distribute software that uses those symbols though. I would have to instruct all users on how to install a special font correctly if they are using Windows Terminal. Any ideas on how to address where the default is coming from?

If it was consistent and all the Unicode chess pieces were rendered as emoji, that would okay too. At least they would be usable together.

Seems like this isn't limited to Windows Terminal: Discord has a similar issue: image And in Chrome: image

I'm not sure if that means it's a Windows OS problem, or the best way to report that if it is. Maybe I should report it in the WinUI repo? https://github.com/microsoft/microsoft-ui-xaml Seems like they would probably just have to escalate it to whoever works on DirectWrite or something too though.

paul-hansen avatar May 16 '22 21:05 paul-hansen

My understanding is that there are a number of glyphs that have both a text presentation and an emoji presentation, and you can use a variant selector to choose which style you want. They each have a default style though (when no variant selector is used), and in the case of the black pawn, the default style is meant to be text.

I'm sure I've seen a document somewhere that list all the default styles in a simple table, but the best I can find at the moment is this: https://www.unicode.org/emoji/charts/text-style.html

Apparently U+FE00 - U+FE0F are supposed to be variant selectors which you put after the Unicode character you want to modify. I'm having a hard time finding documentation on which ones do what though. In my testing in WT, all of them just make the character double wide (which is how my chess board looks so square in the first screenshot)

According to https://stackoverflow.com/a/38452396/5399098 U-FE0E is supposed to force the text version. Black Pawn:♟️ Black Pawn with ︎:♟ White Pawn: ♙️ Doesn't seem to work on Github for me but you can copy it into the textbox on https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea and it works there for me. image

paul-hansen avatar May 16 '22 22:05 paul-hansen

Just driving by to say: this touches on #1472 and friends (#8000)!

DHowett avatar May 17 '22 00:05 DHowett

It seems we forgot to mention here that the latest Windows Terminal version now has a setting to disable colored Emojis: image

However, we still need to add support for handling VS-15 and VS-16 so that colored and uncolored Emojis can be mixed. That's a little bit more difficult unfortunately and currently not that high of a priority.

lhecker avatar May 16 '24 18:05 lhecker

just add css property ... font-family: "Arial", "Helvetica", sans-serif; /* Avoids emoji font */ image

Ashutosh-Chikhaliya avatar Sep 22 '24 08:09 Ashutosh-Chikhaliya

VS-16 needs to be supported, I need colored ♠️♥️♣️♦️ characters, I hope we can support it!

czy-29 avatar Jul 06 '25 09:07 czy-29

It's possible that someone (@zadjii-msft maybe) should re-evaluate the priority of this issue. It's been in the backlog as p-3 for several years and issues are being closed as duplicates to it. I feel like this issue isn't as high priority as some of those closed issues might be considered (more than just the pawn affected).

(Personally I'm unsubscribing from this issue as I abandoned the project where I wanted this and I use wezterm now. Good luck!)

paul-hansen avatar Jul 06 '25 20:07 paul-hansen

I agree. This issue needs to be remembered about

zakaryan2004 avatar Nov 22 '25 21:11 zakaryan2004