-
Notifications
You must be signed in to change notification settings - Fork 46
GTK applications display missing glyph instead space after emoji characters #2
Comments
@edent I have confirmed the cause and a workaround for this issue, but I'm trying to figure out an ideal solution. Can you help? The problem is: this font does not, on purpose, have a space character. The OpenType spec recommends all fonts have a space character: https://www.microsoft.com/typography/otspec/recom.htm There isn't one is because we want to fallback to the next font for all other characters. The space character has different widths in different fonts and font styles/weights. The width of a space is drastically different between a monospace font and a sans-serif font for example. This shouldn't be a problem (AFAIK), but FreeType(or something else in the font render stack) isn't switching back to the originally selected font after loading character(s) from The workaround is to create multiple font files changing only the width of the space character, but that's ridiculous. The actual solution is, probably, to determine what is causing that extra space to load. The DejaVu font family, primary default fallback on many Linux distributions, has five different space widths alone: $ grep "\"space\" w" *
DejaVuSans-BoldOblique.ttx: <mtx name="space" width="713" lsb="0"/>
DejaVuSans-Bold.ttx: <mtx name="space" width="713" lsb="0"/>
DejaVuSansCondensed-BoldOblique.ttx: <mtx name="space" width="641" lsb="0"/>
DejaVuSansCondensed-Bold.ttx: <mtx name="space" width="641" lsb="0"/>
DejaVuSansCondensed-Oblique.ttx: <mtx name="space" width="585" lsb="0"/>
DejaVuSansCondensed.ttx: <mtx name="space" width="585" lsb="0"/>
DejaVuSans-ExtraLight.ttx: <mtx name="space" width="651" lsb="0"/>
DejaVuSansMono-BoldOblique.ttx: <mtx name="space" width="1233" lsb="0"/>
DejaVuSansMono-Bold.ttx: <mtx name="space" width="1233" lsb="0"/>
DejaVuSansMono-Oblique.ttx: <mtx name="space" width="1233" lsb="0"/>
DejaVuSansMono.ttx: <mtx name="space" width="1233" lsb="0"/>
DejaVuSans-Oblique.ttx: <mtx name="space" width="651" lsb="0"/>
DejaVuSans.ttx: <mtx name="space" width="651" lsb="0"/>
DejaVuSerif-BoldItalic.ttx: <mtx name="space" width="713" lsb="0"/>
DejaVuSerif-Bold.ttx: <mtx name="space" width="713" lsb="0"/>
DejaVuSerifCondensed-BoldItalic.ttx: <mtx name="space" width="641" lsb="0"/>
DejaVuSerifCondensed-Bold.ttx: <mtx name="space" width="641" lsb="0"/>
DejaVuSerifCondensed-Italic.ttx: <mtx name="space" width="585" lsb="0"/>
DejaVuSerifCondensed.ttx: <mtx name="space" width="585" lsb="0"/>
DejaVuSerif-Italic.ttx: <mtx name="space" width="651" lsb="0"/>
DejaVuSerif.ttx: <mtx name="space" width="651" lsb="0"/>
$ cat *.ttx | grep "\"space\" w" | sort | uniq | wc
5 20 221 Apple sets it to zero: $ grep "\"space\" w" Apple\ Color\ Emoji.ttx
<mtx name="space" width="0" lsb="0"/> I've generated a font with a full-width space character to test. The space is amusingly obvious in the header: |
I've narrowed down the cause of this text display problem (other than the missing space in the font) and decided on a best case solution for now without going further down this rabbit hole. I tried a Kubuntu 15.10 LIveCD: I tried a few QT vs GTK applications on my install, then ran a QT text field demo and a GTK text field demo: Best case solution given current Linux distribution defaults is to make two versions of the font. One matching the width of spaces in DejaVu Serif/Sans-Serif, and the other matching DejaVu Monospace. I'm going to leave this issue open for a while before making these two additional fonts to see if anyone has a better solution. Either way, the ideal solution is far outside of my control in this font. |
According to the Potential temporary workarounds:
@IBBoard Any other ideas? |
I've had a look at the Fontconfig documents and it isn't clear. From the tags listed in the docs then having (Also, sorry for the dupe. I don't know how I missed this ticket!) |
+:100: It works really well, but the config is so complex.
No problem. I'm always careful when closing issues as dupes, because I don't want to deter contributions/help. I appreciate other people looking into this issue. Bug description I've confirmed this is a problem for nbsp 0xa0 too, so the font needs all whitespace characters. Relevant bugs on gnome.org:
|
I've updated the spaces are half as long after a unicode symbol gnome.org bug with a screenshot and relevant details (aka nothing about this font, because it's not relevant to the specific issue.) Workaround Plan: I'm going to make two versions of the font for Linux. One with monospace whitespace characters and one with the normal DejaVu Sans lengths. Slight change to the |
@crepererum Yes, although I haven't seen this specific issue it looks like a manifestation of the same issue. I'll be creating a set of fonts to workaround this issue with GTK(pango). Please hold off on a separate issue until then. Thank you!
|
@eosrei That's what I was looking at. The obvious (Unless, of course, I'm misunderstanding the documents and it has no way of specifying Unicode ranges to exclude - but then |
@IBBoard I'm fairly sure that, even if we can determine a correct fontconfig, it won't fix this issue due to the bug (design "feature"?) in Pango/GTK. 😞 Note to anyone who may have something to add to that bug report: Please don't mention this font, it'll complicate the resolution. |
Status update There are 25 kinds of whitespace in unicode:https://en.wikipedia.org/wiki/Whitespace_character#Unicode I am creating two "starter" fonts. One using the DejaVuSans whitespace widths and the other using the DejaVuSansMono widths. I'll add a new option to SCFBuild to accept an input file, then generate two versions of the font for Linux and make a zip file with both. |
The OpenType Spec recommends a font have the space character, but doesn't require it. Reference: https://www.microsoft.com/typography/otspec/recom.htm IMO, all of these programs expecting a space are at fault. Haha! it's a bit amusing really, but I wish I were wrong. I am going to add all of the recommended characters to both fonts to avoid this. |
Specifically add notdef, null, CR and space. Space is hardcoded to a width of 1024. Todo: Space width should be a config yaml option. The font rendering systems are supposed to fallback to the space width in the next available fallback font, but it doesn't work reliably. Workaround for: 13rac1/emojione-color-font#2 Caused by: https://bugzilla.gnome.org/show_bug.cgi?id=757785 Related: 13rac1/emojione-color-font#17
Requires Bitstream Vera as the default serif, sans-serif, and monospace font family since it contains no emoji characters. Any other emoji-less font can be used, but most systems include Bitstream Vera so it is used here as the example default. Noto works well except primarily for 0x2639 and 0x263a. See fonts.conf example: fontconfig/user-bitstream-vera-fonts.conf Workaround fix for #2 Related to #17
This issue is "fixed" by adding a space character with a width equal to DejaVu and Bitsteam Vera Sans then making Bitstream Vera or Noto the default font family. Bitstream Vera contains no emoji characters, and Noto contains very few. See soon-to-be-recommended-default |
So wait, let me get this right - this new config will default the text to Bitstream fonts rather than whatever we've set in (for example) Gnome Tweak? |
@IBBoard You can change it to whatever you want, but I need to create/produce/distribute a working "standard" out-of-the-box install method. I've looked at fontconfig for hours and hours and I'm so over it. :-/
AFAIK Gnome Tweak does not change the fontconfig. I recommend you install my provided conf, then adjust that for your specific needs. Beta3 cannot be your default font because it includes a space character and will break monospace formatting. Not having a space character is what caused this issue to exist, so it's sadly not an option either. I'm open to any other solutions! |
From a bit of poking then I don't quite know how Gnome Tweak does it. Replacing "Bitstream Vera" with "Liberation" (then replacing "Sans Mono" with "Mono") seems to work. I can managed with the white smiley face being B&W - it's the tiny one that I try to avoid anyway, and most people probably use the nearby one that's full-size. I know what you mean about fiddling with Font Config, though. I didn't do anywhere near as much as you've gone and it was a pain. It seems like you should be able to do things (like selectively pick fonts for certain character ranges) but none of it is documented and none of it works. Thanks for all the work! |
Haha, it's actually a full size emoji in the source and works correctly with
Nope! It's only a feature request! 😭
Sure! Thanks for testing/using it. |
FYI The GTK/Pango issue has been acknowledged and the creator of Pango has described a good solution. Not sure the resolution will make it downstream to current distributions, but it'll be corrected in the future. 🎉 😄
|
I thought this was a fluke earlier, but it's definitively not. The header in Firefox displays the missing glyph character in some instances. I may need to adjust the null character or add a space. Could be related to #1, but I doubt it at this point.
The text was updated successfully, but these errors were encountered: