Fontconfig/zh-cn

fontconfig库旨为所有图形界面应用程序提供统一的字体选择和配置. 尽管不同的桌面环境 提供它们自己的字体重写和配置服务是很常见的，fontconfig仍然属于底层库.

安装
当需要 时，它应该是已经安装好了的. 如果没有，请确保你正确安装配置好了图形系统 (即 X 或 Wayland) 和desktop environment.

USE 标记
并没有什么USE标记.

通用配置
使用来自 目录的 XML 文件生成内部配置. 默认情况下，它会解析 (普通用户不应该编辑此文件！) ，它会使用一些默认的配置并解析 内的内容. 另外还有个 目录包含了  的各种配置文件. 一般我们把需要的文件链接到 目录. 这些文件按照它们的命名排序使用，它们以俩位数字开头，第一个数字（10）表示文件的影响力（类别）

Gentoo特色
Gentoo有一个 eselect 模块 ，完全符合通用配置方式-它管理   中的链接，通过删除或添加到  目录的链接. 当然，更改这些配置也需要适当的权限（Root）.

以下几个小节将介绍如何使用 模块

可用文件列表
命令可以显示 可用的文件列表， 并标记启用的配置为星号.

启用配置文件
配置文件可以通过文件名或序号启用. 这俩者没有区别：

禁用配置文件
同样也可以这样禁用：

定制全局配置
如果你想创建自定义的 全局配置，请启用  并创建  （这是一个XML文件）.

以上配置简单来说就是当使用sans-serif字体时，倾向使用Ubuntu， TakaoPGothic 和 Droid Sans 字体（按顺序）而不是 DejaVu Sans字体（只有在必要时才使用）. 当然，你也可以设置不同的字体.

单用户配置
如果要创建使用单用户 配置，启用   （可能已经被默认启用），用户最后将使用  配置文件. 该文件与 同为XML格式.

Checking configuration
Check the default font replacement, for example for Arial, by typing:

Anti-aliasing, hinting, and sub-pixel rendering
Rendering aspects can be tuned as well. In the following sections the Anti-aliasing, Hinting and Sub-pixel rendering features are tuned.

Forcing hinting
The default behavior regarding hinting is rather undocumented, but it can be made deterministically sub-optimal by making a system wide default.


 * 1) First enable
 * 2) Edit the  file to include full hinting by default

This snippet enables full hinting:

Using sub-pixel rendering
It's important to determine the sub-pixel layout of the LCD matrix. It's usually RGB but the only way to be sure is to either consult display specification or use this sub-pixel layout test to determine it.

Once determined, enable the appropriate file.

It's strongly advised that, if available, is used with sub-pixel rendering. It comes in different varieties but the default should be appropriate for all common fonts.

Regarding autohinter
Autohinter attempts to do automatic hinting disregarding any existing hinting information. Until recently it was the default because TrueType2 was covered by patents but now that they have expired there's very little reason to use it. From technical point of view it does better than broken or no hinting information but it will be strongly sub-optimal for fonts with good hinting information. Generally system fonts are of the second kind so autohinter should not be used.

Infinality
Infinality is a (somewhat controversial) set of patches for FreeType and accompanying files. The goal of Infinality is to provide higher quality font rendering including emulation of other OS font rendering styles.

Enabling Infinality
Enable the 'infinality' USE flag by editing either manually or by using the  tool.

Next, rebuild the affected programs.

Unless messages shown after rebuild tell otherwise, enable.

Configuring Infinality
Infinality can be configured in various ways including custom configurations, but easiest is to use pre-made profiles shipped in that along with eselect modules should have been installed as dependencies of the   USE flag.

Quick and reasonable config
It's also recommended to disable all settings except for  as they interfere with the rendering of infinality styles:

Certain settings do not interfere with how the fonts are rendered, but rather determine the default fonts for font-types (such as Monospace, sans-serif, etc.). Such settings (for example the configurations) can be left enabled.

Explanation
Infinality provides FreeType environment variables that can be used to configure features introduced with its patches as well as files to be used with these changes. file sets are administrated on Gentoo via while the FreeType behaviour is set using.

These eselect modules function as usual:


 * Listing available file sets.


 * Listing available FreeType variable sets.


 * Both sets should match of course except when there are multiple matches possible such as shown below.

Picking fonts
Choosing the right font can be trickier than deciding on the right hinting type. For one reason or another, some fonts will never be perfect — but it's certainly possible to make them look better than, say, the Windows 7 default font configuration.

Here are some recommendations regarding well known fonts in Gentoo:

External resources

 * In-depth articles from Arch Linux wiki on:
 * Font configuration
 * Infinality
 * Official documentation for users
 * Wikipedia article on font hinting