Skip to content

Glitches when displaying Unicode emoji #671

Closed

Description

mintty seems to misdetect the width of Unicode emoji (e.g.: 🍳), causing display glitches. The issue is not exclusive to mintty, it also happens with e.g. PuTTY, but I've ruled out mostly everything else. It happens even in a local shell with no tmux or anything, and my locale settings are all UTF-8 – both in mintty and the environment. Tried many different fonts: Consolas, DejaVu Sans Mono, Fira Mono, Input Mono...

OS: Windows 10 Home x64 (Creators Update), Ubuntu 17.04 in Windows Subsystem for Linux
mintty: 2.7.8 (wsltty 0.7.83)

Also tested with mintty 2.7.3 (Git Bash 2.12.2.windows.2)

Locale settings
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Examples:

Activity

  1. mintty commented on Jul 16, 2017

    @mintty
    Owner

    Unless with issues #638 or #615, in this case the respective character is wide, but only since Unicode 8.0, when it was changed from being narrow in earlier versions.
    As soon as cygwin locale data are updated to be based on a later Unicode version, display should adapt automatically.
    For now, the only solution would be to offer an option to define character width based on mintty's own width data (like xterm -mk_width, see also #88).

  2. added a commit that references this issue on Jul 24, 2017
  3. alanfran commented on Aug 22, 2017

    @alanfran

    There has been some activity on the Cygwin mailing list that appears to be about this issue.

    Original Post (July 26)
    Subject Index

  4. mintty commented on Aug 22, 2017

    @mintty
    Owner

    Yes, I asked for an update and provided a patch meanwhile.

  5. nshtg commented on Oct 25, 2017

    @nshtg

    2.8.0 has these Bugs. Has there been any progress?

    Also: Is it planned to enable "custom" fonts to provide emojis (and other Unicode chars), e.g. with color?

  6. mintty commented on Oct 25, 2017

    @mintty
    Owner

    As explained above, this is not really a mintty issue (although there could be a workaround) but a cygwin/locale issue. My request to update cygwin Unicode data has not yet been accepted.

  7. mintty commented on Oct 25, 2017

    @mintty
    Owner

    Emojis can be displayed like normal glyphs if the selected font includes them.
    Whether colour glyphs are displayed, depends on support by the Windows API being used (Uniscribe);
    I doubt it.

  8. nshtg commented on Oct 25, 2017

    @nshtg

    Is there a specific reason why you prefer Uniscribe over DirectWrite?

  9. mintty commented on Oct 25, 2017

    @mintty
    Owner

    See #430.

  10. mintty commented on Oct 31, 2017

    @mintty
    Owner

    Released 2.8.1 with new option Charwidth=unicode to activate built-in character width reference.

  11. nshtg commented on Oct 31, 2017

    @nshtg

    I can confirm the fix too. Thank you!!

  12. added a commit that references this issue on Jan 23, 2018
  13. 1 remaining item

  14. mintty commented on Feb 6, 2018

    @mintty
    Owner

    Released 2.8.4 with full emoji support.

  15. lizy14 commented on Feb 8, 2018

    @lizy14

    Charwidth works far less than perfect.
    steps:

    1. paste an emoji
      image
    2. press Home
      image
      note that the cursor is no longer visible
    3. key-in 12
      image
      note the unexpected width
    4. press Home again
      image
      note the unexpected cursor position
    5. key-in 12 again
      image
      nothing but chaotic. expecting 1212, got 1 21212 instead.

    config:

    Charwidth=unicode
    Emojis=apple
    EmojiPlacement=middle
    

    with Windows 10 latest.

  16. mintty commented on Feb 8, 2018

    @mintty
    Owner

    This is an inevitable consequence of using the Charwidth setting.
    See https://github.com/mintty/mintty/wiki/Tips#character-width about it. Admittedly the warning should also be included in the manual page.

    Once Cygwin is updated to provide Unicode 9.0 or later width properties, Charwidth will no longer be needed to tweak emojis to their intended width. (And I provided a patch for an update.)
    Charwidth is only a workaround as long as Cygwin stays at Unicode 5.0 width data. It's a trade-off. You can go without it, and perhaps set EmojiPlacement=full.

  17. mintty commented on May 20, 2020

    @mintty
    Owner

    Released 3.1.5 with explicit character width attribute support.

  18. fmaiabatista commented on Jun 22, 2020

    @fmaiabatista

    Hey guys,

    I'm having difficulties understanding why I can't get an emoji to display inside Cygwin/Mintty whereas it is displayed correctly in Msys/Mintty

    The image should be self explanatory - Cygwin/Mintty on the left, Msys/Mintty on the right - both Fira Code, 11pt, no other changes

    Worth mentioning I'm not terminal/shell savvy to the point of not understanding exactly what is the definition of a terminal as opposed to a shell and how Cygwin x Mintty x Msys compare and interoperate.

    More info: running Fish as the shell and Starship as the theme. Windows 10.

    image

  19. mintty commented on Jun 23, 2020

    @mintty
    Owner

    Where did you install the emojis? If you put them into your MSYS home directory (~/.config/mintty/emojis), cygwin cannot see them because your home directory is somewhere else (unless reconfigured). You'll have to copy (or hard-link) the emojis into your cygwin ~/.config/mintty/emojis, or move them to a common place: $APPDATA/mintty/emojis.

  20. fmaiabatista commented on Jun 23, 2020

    @fmaiabatista

    I'm not sure I know where I installed the "emojis" because all I did a while back was get the Fira Code font for my editor and also get the Powerline fonts. So because I'm on Windows all I did was install the fonts and now they appear in Font Manager.

    image

    I couldn't find any of the paths you mentioned at ~/.config/mintty/emojis (either cyg or msys) or %appdata%/mintty/emojis

    image
    image

  21. mintty commented on Jun 23, 2020

    @mintty
    Owner

    So do you actually have coloured image emojis? Or just the font-included monochrome emoji glyphs?
    In that case, it may just be a matter of using different fonts.

  22. fmaiabatista commented on Jun 23, 2020

    @fmaiabatista

    I believe it's the first case, monochrome font-included emoji glyphs.

    In that case, it may just be a matter of using different fonts.

    That's the thing. I expected it would work in both because they are running the same "terminal emulator" behind (mintty 3.1.8)?

  23. mintty commented on Jun 24, 2020

    @mintty
    Owner

    You have local configuration and common configuration.
    To install real emojis, please check the wiki Tips.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions