-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange rendering of emojis #69
Comments
Note the first grean triangle-arrow is my prompt, the line starts with the read emoji. |
Also, tried to enter it by ctrl-shit-u and unicode code (1f600) but that doesn't work at all, that just prints the digits and letters. |
This could be connected to the braile issue (same underlying cause). If you run with |
Yes I get |
@MoSal normalization of width should take into account the unicode width of the glyph, since that is what terminal programs will use to determine how many columns were used (https://docs.rs/unicode-width/latest/unicode_width/) |
Yes, that is pretty strange. Noto color emoji should be preferred so I'm not sure why it is falling back to another font. |
I would like to see what happens with pop-os/cosmic-text#215 applied first. |
But font resize uses the width of ' ' to avoid this! |
There was no difference using the fallback_codepoints branch When I look at the debug output I see that
It uses DejaVu Sans for the first substitution and then Noto Color Emoji. Also, I realize it looks extra weird, since the zsh auto suggestion is suggesting previous emoji tests... but without that it still is like in the screenshot that it first fallbacks to the ugly emoji for the first char in the line, and after that it uses the correct emoji. |
Deleted the screencast since that just got confusing due to zsh autosuggestions... |
Since DejaVu Sans and Noto Color Emoji are not monospace fonts, whatever got resized probably wasn't an emoji! |
@snaggen If you could test with the |
Wait, |
Emoji fonts, probably some CJK fonts too, are monospace. |
Nevermind, not CJK fonts. |
Actually, there are monospace CJK fonts. This means there are monospace full width characters other than emojis. |
"Noto Color Emoji" reports itself as a Monospace font. But resizing glyphs from such a font to fit a certain width may make emojis look rather small. So avoid font resizing with such fonts by not setting `monospace_em_width`. Fixes pop-os/cosmic-term#69. Signed-off-by: Mohammad AlSaleh <[email protected]>
So, some characters would be a multiple of the Monospace width? |
Yes, and unicode-width is the way to know. |
But then again, I made font resizing depend on the width of a space: A space in "Noto Color Emoji" has a horizontal_advance/units_per_em of 2550/2048. Compare that to 600/1000 for Fira Mono. |
I'm not sure it is as easy as special handle emoji fonts.... we have other fonts with symbols, like Nerd Fonts (which may be merged in to various fonts, which can be found on the Nerd Font home page https://www.nerdfonts.com ). The screenshot below shows how some nerd font symbol is rendred in Cosmic Term and Wezterm. I included the letter A for reference. The rust logo is the Nerd Font character with unicode f1617 |
Also, I created #70 to make it easier to use various special unicode characters, that should make it easier to test this since you then just can enter the unicode code for the different characters. |
Good point. This is not Emoji-specific. Another idea to keep monospatiality is to add a rounded factor to resizing:
|
When matching to a default monospace width, big fonts like those containing symbols and emojis got too small from font resizing. Adding a glyph-to-default rounded factor to the calculation should fix that issue without losing monospatiality. Fixes pop-os/cosmic-term#69. Signed-off-by: Mohammad AlSaleh <[email protected]>
When matching to a default monospace width, big fonts like those containing symbols and emojis got too small from font resizing. Adding a glyph-to-default rounded factor to the calculation should fix that issue without losing monospatiality. Fixes pop-os/cosmic-term#69. Signed-off-by: Mohammad AlSaleh <[email protected]>
When matching to a default monospace width, big fonts like those containing symbols and emojis got too small from font resizing. Adding a glyph-to-default rounded factor to the calculation should fix that issue without losing monospatiality. Fixes pop-os/cosmic-term#69. Signed-off-by: Mohammad AlSaleh <[email protected]>
I have some old emoji font installed, not sure which font it belongs to, but then I also have NotoColorEmoji.ttf and that is the emojis I normally see. Now when I paste U+1F600 to a new line in the terminal, it renders it using the old emoji font, but the next time I paste it I get the color emoji (however, rendered very small).
To reproduce
This is how it looks
The text was updated successfully, but these errors were encountered: