User:Alissa Sabre/Notes on fontconfig

From Second Life Wiki
< User:Alissa Sabre
Revision as of 07:45, 20 June 2007 by Alissa Sabre (talk | contribs) (For discussion)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

What is font config?

  • fontconfig is an open source library that helps applications to pick up appropriate font files.
  • fontconfig can enumerate all available font files for applications' and/or users' selection, or it can build and show a list of font files based on some criteria.
  • fontconfig is already used by some well known open source projects, including GTK+.

Why we should or should not use it

Pluses

  • fontconfig is available on virtually all Linux desktop these days.
  • On Linux, fontconfig mediates distribution differences such as font file paths, availability of particular fonts, or file naming.
  • fontconfig is open source, so we can run it on Windows and MacOS.
  • fontconfig has some knowledge on laguages and scripts, allowing prioritized listing of fonts suitable for a particular language environment.
  • fontconfig is compatible with FreeType, that SL viewer relies on.

Minuses

  • fontconfig is not usually available on Windows and MacOS. We can run it on them, but it doesn't work great without pre-configured font database.
  • Creation of the font database is a time consuming job. Usually takes tens of seconds to several minutes, depending on the configuration. (On Linux, font database is cached on disk. On Windows and MacOS, it is not as default.)
  • fontconfig only knows about serif, sans serif, and monospaced styles. Moreover, its style recognition is totally human definition of an external config file. There are no guarantee that a set of selected fonts shares same or similar design.

How we can use fontconfig in Viewer

  • It may be possible to replace current fallback definition (FontSansSerifFallback in settings.xml) by fontconfig.
  • We can even use both; i.e., mixing fontconfig created list of fonts and those in settings.xml.
  • We can use fontconfig on Linux only, or can use on all platforms.
  • We can use fontconfig to simply enumerate all available fonts and use our own defintion to pick up ones to use.
  • Building a list of fonts using fontconfig is somewhat time consuming, so it's better to build the list once during startup.