Set 'lang: und-zsye' rather than 'family: emoji' for emoji characters
Submitted by Dam..@..il.com
Link to original bug (#792724)
Description
In pango, since bug https://bugzilla.gnome.org/show_bug.cgi?id=785566, when an emoji character is detected, the fontconfig request is overrided with the "emoji" family.
I understand this is done to override emoji characters in some fonts, eg Deja Vu Sans Mono already specify a lot of black and white emoji characters. With this patch, an emoji font, like 'noto color emoji', is used for these characters instead.
However, I think that if the user specify a specific font, glyphs from this font should be used. For instance in my terminal the font is "Deja Vu Sans Mono", and I really wnat the symbols from "Deja Vu Sans Mono" to be used, rather than color emojis which are distracting in a terminal.
Luckily both behaviours (emoji take precedence for a generic font request but not for a specific font request) can be obtained by setting the lang to 'und-zsye' rather than replacing the family.
Indeed in fontconfig, weak family bindings are overrided by language settings, while strong bindings are not.
So eg when requesting a font with 'family: sans, lang: und-zsye', and with an alias like
<alias>
<family>
sans-serif</family>
<prefer>
<family>
DejaVu Sans</family>
</prefer>
</alias>
which defines a weak binding by default, then fonts which implement the und-zsye langage will be prefered to 'DejaVu Sans' so we will get color emojis.
(And moreover since in fontconfig, 45-generic.conf contains:
<match>
<test name="lang">
<string>
und-zsye</string>
</test>
<test qual="all" name="family" compare="not_eq">
<string>
emoji</string>
</test>
<!-- Add generic family. -->
`<edit name="family" mode="append" binding="strong">`
`<string>`emoji`</string>`
`</edit>`
`</match>`
a lang=und-zsye request will include all the fonts from the emoji family).
But when requesting 'DejaVu Sans' explicitely, since this is a strong binding it will use characters from DejaVu Sans first, as requested.