2

Actually, I think my question is too basic, but, even after performing a deep search on internet, I still didn't understand how a browser selects a particular font for rendering a particular script on Linux systems. I know that Linux systems have fontconfig for managing font rendering in applications, but the behaviour of fontconfig is not consistent with respect to browsers. Mainly, Chromium and its derivatives don't always obey fontconfig rules. They try to select fonts on their own. On the other hand, Firefox and its derivatives have very good integration with Linux systems and they tend to obey fontconfig settings. I tried different browsers to test their behaviour and found that even we have configured rules for specific fonts in fontconfig, we still need more tweaking to get a consistent behaviour among browsers. They tend to choose their own fonts. This led me to confusion. So my questions regarding this are :

  • How a browser actually selects a font as its UI font as well as font for rendering a particular script ?
  • I know that we can specify fonts in CSS, but what will happen if we dont specify them ? How will browsers fallback fonts ?
  • What is the role of fontconfig in terms of browsers ? Do browsers use fontconfig or something else to prioritize fonts ?
  • Am I missing something ?

Please help me to clear my confusion. Any help will be appreciated.

1 Answer 1

4

After a long time of studying the behavior of fontconfig and browsers, I came to know these points :

  1. Fontconfig is comparatively small, but complex piece of software. It has an algorithm that matches the best font for given conditions and rendering parameters. These conditions and parameters are collectively known as "patterns".

  2. There are several characteristics of a font, and different fonts may have some common characteristics as well. So while selecting fonts for a given pattern, all fonts on the systems must be checked to see their relevance. Some fonts have some characteristics overriding others. For ex. some fonts may have Unicode support for exotic scripts/symbols, but may have poor drawing quality. At the same time, some fonts may have Unicode support of comparatively less number of scripts/symbols, but have good drawing quality. In such case, fontconfig tries to prefer the font that is more likely to render the given character set, and may actually ignore the drawing quality. So we simply cannot guarantee the results of fontconfig, because they are more depended on font files themselves, and requesting application's specific requirements. Finally, as users, we always know what font is good for the given case. But fontconfig does not know it. Obviously, It cannot learn about aesthetics, quality and bugs in a font. It just sees every font as a font.

  3. Some apps, like browsers and graphic designing suites may also use their own patterns and fonts if they want. In that case, they may request fontconfig, or behave on their own.

  4. We can reproduce the priority behavior of fontconfig on different systems, but those systems should have exactly same versions of font files, config files and rendering framework. Otherwise, if some font file has updated metrics or script/language data, it may be preferred over the other.

  5. It's always best to set your own fonts.conf file in your home directory to help fontconfig to match the correct font, in case it fails to do so.

More info here : https://www.freedesktop.org/software/fontconfig/fontconfig-user.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .