FS#63815 - [ttf-joypixels] Replaces normal numbers with emojis.
Attached to Project:
Community Packages
Opened by Vista1nik (vista1nik) - Wednesday, 18 September 2019, 07:28 GMT
Last edited by Maxim Baz (maximbaz) - Tuesday, 25 February 2020, 22:04 GMT
Opened by Vista1nik (vista1nik) - Wednesday, 18 September 2019, 07:28 GMT
Last edited by Maxim Baz (maximbaz) - Tuesday, 25 February 2020, 22:04 GMT
|
Details
Description:
Package replaces normal numbers with emojis in Chromium. Additional info: * package version(s): 5.0.2 Steps to reproduce: 1. Install `ttf-joypixels 5.0.2-2` 2. Link it. `sudo ln -sf ../conf.avail/75-joypixels.conf /etc/fonts/conf.d/75-joypixels.conf` 3. Open Chromium on any site. (e.g. https://github.com/) |
This task depends upon
Closed by Maxim Baz (maximbaz)
Tuesday, 25 February 2020, 22:04 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented suggestions for .install notice and the example conf file
Tuesday, 25 February 2020, 22:04 GMT
Reason for closing: Implemented
Additional comments about closing: Implemented suggestions for .install notice and the example conf file
Don't symlink the file, but create your own `/etc/fonts/conf.d/75-joypixels.conf` and use the file in `conf.avail/` as a reference.
Fontconfig is hard, I know! If you have ideas how I can make this config better (to work for more people out of the box), don't hesitate to shoot me an email.
On my side, I will update the comments and install message to make it clearer that the provided `75-joypixels.conf` is first and foremost an example file to use as a reference.
Would it be a solution to, `mode=delete` the non-emojione emoji fonts instead of `mode=replace` them? That way, they are simply removed from consideration and non-emoji fonts are allowed to fill the number glyphs before the fallback to JoyPixels kicks in for any unfilled emoji glyphs.
Those replacements are actually meant not for getting rid of other emoji fonts, but to "fix" apps and websites that hardcode some very specific emoji fonts - this is actually quite common that a website would just declare 'Apple Color Emoji' and nothing else, and in those cases JoyPixels will never be selected as an emoji font.
I would guess that the reason you see numbers rendered as emojis is actually caused by the second block of 75-joypixels.conf, where it is appended to sans, serif, sans-serif and monospace. Try to remove that block and see if it helps you.
> But regardless, some clarification on the .install notice might be helpful.
I'm all for making it more clear! The current message doesn't actually mention that it conflicts with other emoji fonts, it just says "with other fonts", but I can see why you would understand it like that.
Do you have any suggestions? I'm thinking of something along the lines below.
post_install() {
echo
echo " See /etc/fonts/conf.avail/75-joypixels.conf for how to enforce rendering emojis via JoyPixels"
echo " It contains various techniques, some of which can cause issues like rendering numbers as emojis"
echo " Copy the file to /etc/fonts/conf.d/ and modify as needed to make it work for your own setup."
echo
}
If you can confirm that the issue in your case is indeed caused by that second block in 75-joypixels.conf, I can add a comment warning there as well. Let me know.
And no, it's not the second block; in the case of the login page on outlook.live.com it is caused by the following block:
```
<match target="pattern">
<test qual="any" name="family"><string>Segoe UI Symbol</string></test>
<edit name="family" mode="assign" binding="same"><string>JoyPixels</string></edit>
</match>
```
font-family: font1, font2, Segoe UI Symbol, font3, font4
And on your computer you don't have anything that resolves to font1 and font2, so _everything_ gets rendered as Segoe UI Symbol (i.e. as JoyPixels).
And if I'm right, as soon as you install (or define aliases) for at least one font that is preceding Segoe UI Symbol, it will be used to render numbers, and JoyPixel will only render the remaining glyphs that are not part of those fonts.
"Segoe UI Webfont", -apple-system, "Helvetica Neue", "Lucida Grande", "Roboto", "Ebrima", "Nirmala UI", "Gadugi", "Segoe Xbox Symbol", "Segoe UI Symbol", "Meiryo UI", "Khmer UI", "Tunga", "Lao UI", "Raavi", "Iskoola Pota", "Latha", "Leelawadee", "Microsoft YaHei UI", "Microsoft JhengHei UI", "Malgun Gothic", "Estrangelo Edessa", "Microsoft Himalaya", "Microsoft New Tai Lue", "Microsoft PhagsPa", "Microsoft Tai Le", "Microsoft Yi Baiti", "Mongolian Baiti", "MV Boli", "Myanmar Text", "Cambria Math"
None of these are installed on my system.
To show you an example from my dotfiles, here's how I create a font alias that would help me (I think) with this particular page:
https://github.com/maximbaz/dotfiles/blob/6880b36107852ef415bd172e76e128f0a7e3c6dd/packages/30-font-aliases.conf#L58-L63
But I don't think it's something I can fix in the joypixels package, they won't remove numbers, and technically the browser _is_ rendering this page for you with the first available font.
Do you agree if I close this bug with changing the .install notice as above?
But do have a look and let me know if you find something. And thanks for your help!
Commented out entirety of 75-joypixels.conf. Outcomes:
* Emojis are shown in joypixels font in firefox
* Emojis are shown in different font (b&w noto emoji font) in chromium
NB: I do not have noto-fonts-emoji installed. I assume it's built into chromium. From now on I will only test in chromium.
Uncommented "emoji" family joypixels assign. Outcome:
* No change (noto emojis)
Uncommented "sans" family joypixels append. Outcome:
* No change (noto emojis)
Uncommented "serif" family joypixels append. Outcome:
* No change (noto emojis)
Uncommented "sans-serif" family joypixels append. Outcome:
* Emojis are shown in joypixels font in chromium
So "sans-serif" is used by chromium as a fallback even though it's not specified by the website. To confirm:
Commented out everything again and added a new "Cambria Math" replacement with JoyPixels with the following:
<match target="pattern">
<test name="family"><string>Cambria Math</string></test>
<edit name="family" mode="assign" binding="same"><string>JoyPixels</string></edit>
</match>
Outcome:
* Numbers are shown as joypixels emojis
This proves that none of the font-families defined in that page are available on my computer (Cambria Math is the very last entry in the font-family of that element). Yet, the browser falls back to sans-serif. So it seems that having joypixels as fallback for the basic font families, combined with the different "emojione" associations, might be a sane default. Then, one might want to add the rejection of Symbola if both are installed, though, considering it's only available in the AUR, might not need to be a usecase supported in an official repository package.
With regards to the emoji you posted above, it also shows as joypixels with my stripped down fontconfig on chromium, but as a text emoji on firefox... Odd.
I do think that each app has its own internal rules of how to fallback if all defined fonts fail, that's how you get different rendering of ( 😄 ) in Chromium and Firefox, and the fact that your test on outlook login page worked in Chromium might not indicate that you will have the same results in Firefox or other apps...
> So it seems that having joypixels as fallback for the basic font families, combined with the different "emojione" associations, might be a sane default.
I intentionally decided to refrain from providing _any_ default in the package, because it's still very dependent on user specific setup and a list of available fonts. I will let users create their own /etc/fonts/conf.d/75-joypixels.conf as they see fit for their own setup.
As for the example 75-joypixels.conf that is part of the package, I still think it makes sense to include as many aliases to other emoji fonts as possible because of the example I shared earlier. If after changing the install notice I see that the provided 75-joypixels.conf is still being mistaken for a "default" config, I'd rather move it to /usr/share/ttf-joypixels/examples/ to illustrate that point, how ever non-standard that might be for a font package.
Fair point though about rejection of Symbola specifically, on the one hand it's just an example and I think a quite popular one, on the other hand, maybe you are right and it's too specific. I'll think about it 👍
With that in mind, it would probably be a bad idea to have the overwriting of the different Apple/Segoe/Noto/whatever emoji/symbol fonts and especially the rejection of the Symbola font in the default config, as it seems very tied to the assumption that you want to have joypixels over everything else rather than just having it available on your system.
I have an idea for a sane default, is it possible for me to open a pull request or whatever on an official arch package?
I can already tell you, I don't think it's good idea to add this emoji font as a final fallback to generic families by default, because I would not want to ship a config that has potential to make weird behavior even for a small subset of users. First and foremost goal is to ship the font itself, so if you specify "font-family: JoyPixels" you will get emojis. The rest of the things really depend on what you want, some want the fallback, others might not. Maybe someone will have two emoji fonts installed, and they would want the generic font families to fallback on another emoji font, I wouldn't want for example to add a conflict with noto-color-emoji package.
The only thing that I can see as safe to have by default is those EmojiOne aliases, but on the other hand they rebranded almost a year ago, so I don't think it makes sense to ship a default config purely with legacy names.
I wish something like this was possible in fontconfig, then we would be able to just exclude the numbers even if they are present in the font itself. Last time I checked (a few years ago) I wasn't able to find a way to do this, but if you are interested you could give it another try, maybe you will be lucky to find a solution? :)
<match target="scan">
<test name="family" compare="eq">
<string>JoyPixels</string>
</test>
<edit name="charset" mode="assign">
<minus>
<name>charset</name>
<charset>
<range>
<int>0x0030</int>
<int>0x0039</int>
</range>
</charset>
</minus>
</edit>
</match>
However I think this removal trick can still be very useful. On my personal laptop, the black-and-white emojis (like this one -> 😄 ) come from DejaVu Sans font, so if I keep JoyPixels appended and not prepended, but simply remove emoji glyphs from DejaVu Sans font, then rendering in Chromium and Firefox works as expected for me.
<match target="scan">
<test name="family" compare="eq">
<string>DejaVu Sans</string>
</test>
<edit name="charset" mode="assign">
<minus>
<name>charset</name>
<charset>
<range>
<int>0x1f600</int>
<int>0x1f640</int>
</range>
</charset>
</minus>
</edit>
</match>
- install notice is updated to be more clear that 75-joypixels.conf is just an example
- removed Symbola rejection from 75-joypixels.conf (symbola is not in official repos, plus instead of rejecting it one can simply remove the font)
- add example on how to remove emoji glyphs from DejaVu fonts
Thank you so much for your help along the way! If needed, feel free to ping me or drop me an email.