Arch Linux – Troubleshooting Weird Unicode Behavior

arch linuxfontconfigfontsunicode

I'm using Arch Linux and one thing I just can't seem to get right is the Unicode fonts.

I'll give you an example of what goes wrong.
Here's a screenshot of gucharmap:
gucharmap

The selected glyph in the top left renders as it should, but then the Text to copy renders as a completely different icon, from another font presumably.

Then here's a screenshot of urxvt showing the same icon:

urxvt

As you can see, it just renders some boxes. This is the most common behavior across most of my applications.

Also here is the output of fc-list (it's in a paste-bin because it was too long), maybe it's useful, I don't know.

So what I think is happening is that I have another font installed of which the Unicode area overlaps with the one from Material icons.
My question is then, how do I fix this? And is this even the thing that's going wrong?

UPDATE

changing my fontconfig to:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<alias>
    <family>serif</family>
    <prefer><family>Noto Sans</family></prefer>
    <default><family>Material Icons</family></default>
</alias>
<alias>
    <family>sans-serif</family>
    <prefer><family>Noto Sans</family></prefer>
    <default><family>Material Icons</family></default>
</alias>
<alias>
    <family>sans</family>
    <prefer><family>Linux Libertine</family></prefer>
    <default><family>Material Icons</family></default>
</alias>
<alias>
    <family>monospace</family>
    <prefer><family>Hack</family></prefer>
    <default><family>Material Icons</family></default>
</alias>
</fontconfig

has fixed the issue of gucharmap glyphs not matching the Text to copy
however, the issue of applications not rendering the glyphs still remains.

This makes me think the issue is with the applications not using the correct font for rendering the glyphs.
I assumed setting the default tags for the aliases would make it so they would be used as a fallback if the preferred font does not contain the unicode character. I feel like this is wrong though, but the docs don't really make it clear.

UPDATE

Someone asked for the output of locale, so here it is:

LANG=en_GB.utf8
LC_CTYPE="en_GB.utf8"
LC_NUMERIC="en_GB.utf8"
LC_TIME="en_GB.utf8"
LC_COLLATE="en_GB.utf8"
LC_MONETARY="en_GB.utf8"
LC_MESSAGES="en_GB.utf8"
LC_PAPER="en_GB.utf8"
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT="en_GB.utf8"
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=

Best Answer

I want to help you understand how things work so you can troubleshoot those kind of problems yourself. what's happening with you is a very normal behavior.

however, the issue of applications not rendering the glyphs still remains

You didn't mention which application fail. You need to go to each application and set the fonts which contain your glyphs. e.g. LibreOffice, you go to Tools -> Options -> LibreOffice Writer -> Basic Fonts (Western), or Basic Fonts (CTL) and set the fonts for Default, Heading, List, Caption, Index". You shouldn't expect your config file to control that.

Then you might ask:

why is this fontconfig? What is the prefer, default, ... and all that's mentioned in man fonts-conf doing?

One use is if the application has no way of setting its fonts and just obey fontconfig, anther is if you configure your application with generic family name terms like serif, sans-serif, monospace, ... Here, your application would consult fontconfig for your preferred fonts.

Again, every application has its way of setting its fonts. For each one of them you need to configure it the way its meant to be. There is no way you can force all the applications globally to use the fonts you want.

Related Question