|
原文地址: http://edt1023.sayya.org/fontconfig/fontconfig-user.html
fonts-conf
Name
fonts.conf -- 字型设定文件
Synopsis
/usr/local/etc/fonts/fonts.conf
/usr/local/etc/fonts/fonts.dtd
/usr/local/etc/fonts/conf.d
~/.fonts.conf
简述
Fontconfig is a library designed to provide system-wide font configuration, customization and application access.
Fontconfig是全系统以及个人化字型设定的函式库,应用程序可向其索取字型。
功能概览
Fontconfig contains two essential modules, the configuration module which builds an internal configuration from XML files and the matching module which accepts font patterns and returns the nearest matching font.
Fontconfig由两个主要的模块构成,其一是设定模块,把XML设定文件转换成Fontconfig的内部设定;另一为比对模块,将应用程序传来的字型样式需求与现有字型比对,传回最相似的字型。
字型设定
The configuration module consists of the FcConfig datatype, libexpat and FcConfigParse which walks over an XML tree and ammends a configuration with data found within. From an external perspective, configuration of the library consists of generating a valid XML tree and feeding that to FcConfigParse. The only other mechanism provided to applications for changing the running configuration is to add fonts and directories to the list of application-provided font files.
FcConfig datatype,libexpat,FcConfigParse三者所构成的设定模块在解析XML树状结构之后,对Fontconfig重新设定。从外部观之,设定Fontconfig函试库的方法,即为编辑出一个正确的XML档案,然后交给FcConfigParse处理。除此之外,更动字型设定的唯一方法就是把字型和目录加入应用程序提供的字型文件清单中。
The intent is to make font configurations relatively static, and shared by as many applications as possible. It is hoped that this will lead to more stable font selection when passing names from one application to another. XML was chosen as a configuration file format because it provides a format which is easy for external agents to edit while retaining the correct structure and syntax.
其目的就是尽量不更动字型设定,并且让各种应用程序共享一个设定。这样一来当程序之间需要交换字型名称时,所取得的字型较为一致。我们用XML作为设定档的格式,因为XML容易被外部程序编辑,而不会意外地损坏设定文件该有的结构和语法。
Font configuration is separate from font matching; applications needing to do their own matching can access the available fonts from the library and perform private matching. The intent is to permit applications to pick and choose appropriate functionality from the library instead of forcing them to choose between this library and a private configuration mechanism. The hope is that this will ensure that configuration of fonts for all applications can be centralized in one place. Centralizing font configuration will simplify and regularize font installation and customization.
字型设定和字型比对不同;有些程序需要自己比对字型,所以会向Fontconfig询问计算机上所有可用的字型,再自行比对。这让程序可以只针对Fontconfig中合适的功能善加利用,不必采纳Fontconfig的所有设定,所以不会陷入程序本身和Fontconfig设定两者的抉择。然而愿景是让所有程序的字型设定都能集中管理。若字型设定能集中管理,字型的安装和个人化就会简易而有秩序。
字型的性质
While font patterns may contain essentially any properties, there are some well known properties with associated types. Fontconfig uses some of these properties for font matching and font completion. Others are provided as a convenience for the applications rendering mechanism.
虽然字型需求样式可以指定各种性质,但是有些性质才较为常用。 Fontconfig利用下列的性质来做字型比对和字型补全。 (译注:当程序传来的字型格式需求没有一一指定各种需要的性质时,透过字型补全由Fontconfig为其挑选一个适用的字型。) 其它的性质将交给字体绘制程式,以便应用程序另外指定绘制方法。
性质 型态 说明
--------------------------------------------------------------
family 字符串 字族名称 Font family names
familylang 字符串 字族名称所对应的语言 Languages coresponding to each family
style 字符串 字型风格。Fontconfig将无视weight字粗和slant斜体设定 Font style. Overrides weight and slant
stylelang 字符串 字型风格所对应的语言 Languages cooresponding to each style
fullname 字符串 字型全名 (包含风格) Font full names (often includes style)
fullnamelang 字符串 字型全名所对应的语言 Languages cooresponding to each fullname
slant 整数 指定意大利斜体、一般斜体或正体 (罗马字体) Italic, oblique or roman
weight 整数 细、中等、微粗、粗、黑 Light, medium, demibold, bold or black
size 浮点数 字体大小 (单位为point) Point size
width 整数 压缩、正常或加宽 Condensed, normal or expanded
aspect 浮点数 在hinting前将字体再拉宽的倍数 Stretches glyphs horizontally before hinting
pixelsize 浮点数 字体大小 (单位为pixel) Pixel size
spacing 整数 宽度不等、双宽度、等宽度或charcell Proportional, dual-width, monospace or charcell
foundry 字符串 字型公司名称 Font foundry name
antialias 布尔数 字体边缘平滑化 Whether glyphs can be antialiased
hinting 布尔数 字体绘制是否要 hintingWhether the rasterizer should use hinting
hintstyle 整数 自动的hinting风格 Automatic hinting style
verticallayout 布尔数 直式排版 Use vertical layout
autohint 布尔数 使用autohinter而不读取字型内部的hinting指令 Use autohinter instead of normal hinter
globaladvance 布尔数 使用字型提供的全域字宽 font global advance data
file 字符串 字型的文件名 The filename holding the font
index 整数 档案中该字型的index The index of the font within the file
ftface FT_Face 用Freetype指定的字体对象 Use the specified FreeType face object
rasterizer 字符串 使用何种绘制字体程序 Which rasterizer is in use
outline 布尔数 字型是否为中空字型 Whether the glyphs are outlines
scalable 布尔数 字型是否可缩放 Whether glyphs can be scaled
scale 浮点数 Point->pixel变换单位所用的常数 Scale factor for point->pixel conversions
dpi 浮点数 目的装置的dpi Target dots per inch
rgba 整数 unknown, rgb, bgr, vrgb, vbgr, none - 液晶营幕的次像素排列方式 subpixel geometry
minspace 布尔数 消去行距 Eliminate leading from line spacing
charset CharSet 所支援的 Unicode 字集 (codepage?) Unicode chars encoded by the font
lang 字符串 字型所支持的语言,用RFC-3066格式表式 (译注:例如zh-TW) List of RFC-3066-style languages this font supports
fontversion 整数 字型的版本编号 Version number of the font
capability 字符串 字型的排版能力 List of layout capabilities in the font
embolden 布尔数 字体绘制程式是否需要再额外加粗字体 Rasterizer should synthetically embolden the font
译注:浮点数是双精数。
再注:有关不同整数的意义,可参考下面const元素的说明。
字型比对
Fontconfig performs matching by measuring the distance from a provided pattern to all of the available fonts in the system. The closest matching font is selected. This ensures that a font will always be returned, but doesn't ensure that it is anything like the requested pattern.
当接收到字型的样式需求,Fontconfig会将之与计算机现有的字型逐一比对,比对其间之差距。然后从结果中选出最接近的字型。虽然一定会传回一个字型,但不保证传回的字型和需求的样式有多相符。
Font matching starts with an application constructed pattern. The desired attributes of the resulting font are collected together in a pattern. Each property of the pattern can contain one or more values; these are listed in priority order; matches earlier in the list are considered "closer" than matches later in the list.
首先应用程序必须提出一个字型的样式需求。应用程序所想要的属性会集中起来,成为一个样式。样式里的每一种性质可能不只一个值;若有多个值,系依优先级排列;所以如果现有的字型中和较前面的值相符,就算是「较为接近需求」。
The initial pattern is modified by applying the list of editing instructions specific to patterns found in the configuration; each consists of a match predicate and a set of editing operations. They are executed in the order they appeared in the configuration. Each match causes the associated sequence of editing operations to be applied.
在字型比对之前,Fontconfig会依照一系列修订指令来修改样式需求,不同的样式可以有不同的修订指令;每一个修订指令分成两个部份:比对和修改。(译注:这里的比对,指样式需求和设定比对,不是和现有的字型比对。) 修订指令依照于设定文件中的出现顺序执行。若比对正确,即依指令修改样式。
After the pattern has been edited, a sequence of default substitutions are performed to canonicalize the set of available properties; this avoids the need for the lower layers to constantly provide default values for various font properties during rendering.
需求样式经过修改后,接下来就进行预设的替换,把不典型的性质换为典型的性质;这么一来下层的画字程序就不必一直提供默认值给不同的字型性质。
The canonical font pattern is finally matched against all available fonts. The distance from the pattern to the font is measured for each of several properties: foundry, charset, family, lang, spacing, pixelsize, style, slant, weight, antialias, rasterizer and outline. This list is in priority order -- results of comparing earlier elements of this list weigh more heavily than later elements.
经过修订和替换的步骤后,典型的需求样式终于要和计算机中的字型逐一比对了。样式和字型的差距是藉由比对下列性质再换算而得的: foundry, charset, family, lang, spacing, pixelsize, style,slant, weight, antialias, rasterizer 和 outline。上面是依优先级列出,比较前面的权重较大。
There is one special case to this rule; family names are split into two bindings; strong and weak. Strong family names are given greater precedence in the match than lang elements while weak family names are given lower precedence than lang elements. This permits the document language to drive font selection when any document specified font is unavailable.
有一个特别规则:字族名称 (family) 分为两种约束:强和弱(strong and weak)。(译注:binding怎么翻?)强字族名称比字型所支持的语言 (lang) 更为优先,弱字族名称反之。在文件指定的字型都不在计算机里的时候,这可以让语言引导字型的选择。
The pattern representing that font is augmented to include any properties found in the pattern but not found in the font itself; this permits the application to pass rendering instructions or any other data through the matching system. Finally, the list of editing instructions specific to fonts found in the configuration are applied to the pattern. This modified pattern is returned to the application.
如果需求样式的性质中有字型本身所没有的性质,这些额外的性质会被保留住;这允许应用程序通知画字程序另外的指示或数据,不因修改及比对而被干扰。最后,样式再次依照设定文件中的修订指令修改。再次修改后的样式才会传回给应用程序。
The return value contains sufficient information to locate and rasterize the font, including the file name, pixel size and other rendering data. As none of the information involved pertains to the FreeType library, applications are free to use any rasterization engine or even to take the identified font file and access it directly.
传回值提供字型的位置和画字的方法,包含档名、pixel大小和其它画字数据等。由于传回的信息并非专属于FreeType,所以应用程序可以自行选则画字引擎,甚或利用传回的文件名直接存取字型文件。
The match/edit sequences in the configuration are performed in two passes because there are essentially two different operations necessary -- the first is to modify how fonts are selected; aliasing families and adding suitable defaults. The second is to modify how the selected fonts are rasterized. Those must apply to the selected font, not the original pattern as false matches will often occur.
比对和修改 (也就是修订指令) 一共进行两次,因为根本上就有两件事要做--第一要调整字型选择的方法:主要是为字族名称起别名和加上适合的默认值。第二件事是选好字型后,针对选上的字型修正其画字方式。只可以在选上的字型上做第二次的修改,不可以在需求样式上做第二次的修改,因为第二次的比对方式时常有错误的比对成功。
字型名称(译注:不是字族名称)
Fontconfig provides a textual representation for patterns that the library can both accept and generate. The representation is in three parts, first a list of family names, second a list of point sizes and finally a list of additional properties:
Fontconfig可以收发的字型样式是用文字表示的。 (译注:字型样式的文字表示,称作字型名称。别和字族名称搞混了。) 这种表示法分为三个部份,第一部份是条列字族名称,然后是条列point sizes,最后才是其它的性质:
<字族名称列表>-<大小列表(point sizes)>:<性质1>=<数值列表1>:<性质2>=<数值列表2>...
Values in a list are separated with commas. The name needn't include either families or point sizes; they can be elided. In addition, there are symbolic constants that simultaneously indicate both a name and a value. Here are some examples:
数值列表用逗点分开。字型名称可以不包含字族名称或是大小(point sizes)。此外有符号常数可以同时指定性质和其数值。下面是一些例子:
字型名称 意义
----------------------------------------------------------
Times-12 12 point Times 罗马体(正体) 12 point Times Roman
Times-12:bold 12 point Times 粗体 12 point Times Bold
Courier:italic Courier 意大利斜体,使用预设大小 Courier Italic in the default size
Monospace:matrix=1 .1 0 1 用Monospace以及合成斜体 The users preferred monospace font with artificial obliquing
(译注:matrix不属于字型的性质,所以matrix=1 .1 0 1会原封不动的传回给应用程序)
语言标帜
Each font in the database contains a list of languages it supports. This is computed by comparing the Unicode coverage of the font with the orthography of each language. Languages are tagged using an RFC-3066 compatible naming and occur in two parts -- the ISO 639 language tag followed a hyphen and then by the ISO 3166 country code. The hyphen and country code may be elided.
数据库里的每一个字型都有其所支持的语言的清单。藉由比较字型涵盖Unicode的范围和每个语言所用到的文字,Fontconfig可以算出字型支持的语言。语言标帜和RFC-3066兼容,分成两个部份--依前后是ISO 639语言标帜和ISO 3166国码,用连字号相连。连字号和国码可以省略。
Fontconfig has orthographies for several languages built into the library. No provision has been made for adding new ones aside from rebuilding the library. It currently supports 122 of the 139 languages named in ISO 639-1, 141 of the languages with two-letter codes from ISO 639-2 and another 30 languages with only three-letter codes. Languages with both two and three letter codes are provided with only the two letter code.
Fontconfig内建有多种语言所用到的文字。除非重新编译Fontconfig,不然没有办法新增。目前支持了ISO 639-1里139种语言的122种,和ISO 639-2里用两个字母表示的语言141种及三个字母表示的30种。用两个字母或三个字母都可以表示的语言,就用两个字母为代表。
For languages used in multiple territories with radically different character sets, fontconfig includes per-territory orthographies. This includes Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese.
针对一些在不同地区使用完全不同的字集的语言,Fontconfig对不同地区语文所记录的「语言所使用的文字」也不一样。这包括亚塞拜然文、库德文、普什图文、提格利尼亚文和中文。(Azerbaijani, Kurdish, Pashto, Tigrinya and Chinese)
设定档格式
Configuration files for fontconfig are stored in XML format; this format makes external configuration tools easier to write and ensures that they will generate syntactically correct configuration files. As XML files are plain text, they can also be manipulated by the expert user using a text editor.
Fontconfig的设定档是XML格式;这种格式的好处是易于外部设定程序编辑,确保能编辑出语法正确的设定文件。因为XML文件是纯文字,所以有经验的使用者也可以用一般的文字编辑器修改之。
The fontconfig document type definition resides in the external entity "fonts.dtd"; this is normally stored in the default font configuration directory (/usr/local/etc/fonts). Each configuration file should contain the following structure:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
...
</fontconfig>
Fontconfig文件格式定义(document type definition)是外部实体「fonts.dtd」;这个档案一般存放在预设的字型设定目录内 (/etc/fonts)。每一个设定文件都应该包含如下的结构:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
...
</fontconfig>
<fontconfig>
This is the top level element for a font configuration and can contain dir, cache, include, match and alias elements in any order.
这是字型设定文件的顶层元素,可以容纳多个 dir, cache, include, match, alias, config, 和selectfont等元素,次序不限。
dir
This element contains a directory name which will be scanned for font files to include in the set of available fonts.
这个元素容纳一个目录名称,存放在此的字型文件会被当作是可以使用的字型。
cache
This element contains a file name for the per-user cache of font information. If it starts with '~', it refers to a file in the users home directory. This file is used to hold information about fonts that isn't present in the per-directory cache files. It is automatically maintained by the fontconfig library. The default for this file is ``~/.fonts.cache-version'', where version is the font configuration file version number (currently 1).
这个元素容纳一个文件名,用来存放每一个使用者的字型信息快取。如果檔名以「~」为起头,代表指到使用者的家目录下的档案。这个档案里,存放了一些不在其它目录的快取的字型的信息。这由Fontconfig自动维持。预设是``~/.fonts.cache-version'',version是字型设定文件的版本编号(目前是1)。
include ignore_missing="no"
This element contains the name of an additional configuration file or directory. If a directory, every file within that directory starting with a number will be processed in sorted order. When the XML datatype is traversed by FcConfigParse, the contents of the file(s) will also be incorporated into the configuration by passing the filename(s) to FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the default "no", a missing file or directory will elicit no warning message from the library.
这个元素容纳一个设定文件的文件名或是一个目录名。如果容纳的是目录名,该目录下的每一个以数字为文件名开头的档案,都会被当字型设定文件来依序处理。当FcConfigParse处理字型设定文件时,设定文件里该元素容纳的档案 (或该元素容纳的目录下的档案) 会交给FcConfigLoadAndParse使之与目前的设定结合。如果「ignore_missing」设为"yes"而不是预设的"no",而且元素里的文件名并不存在,Fontconfig不会为之产生警示讯息。
config
This element provides a place to consolodate additional configuration information. config can contain blank and rescan elements in any order.
这个元素用来存放其它的设定信息。 config可容纳多个blank和rescan元素,顺序不限。
blank
Fonts often include "broken" glyphs which appear in the encoding but are drawn as blanks on the screen. Within the blank element, place each Unicode characters which is supposed to be blank in an int element. Characters outside of this set which are drawn as blank will be elided from the set of characters supported by the font.
虽然字型的编码可能有编到,但是字型经常阙漏字体,阙漏的部份画起来是空白的。在blank元素里,把本来就应该是空白的字体其编码用int元素容纳,内容是每一个空格符的Unicode编码。不包含在这里的字符如果画起来还是空白的,就会被当作不被此字型支持的字符。
rescan
The rescan element holds an int element which indicates the default interval between automatic checks for font configuration changes. Fontconfig will validate all of the configuration files and directories and automatically rebuild the internal datastructures when this interval passes.
rescan元素容纳一个int元素,用来设定多少秒自动检查一次字型设定。 Fontconfig在指定的时间过后会检查所有的设定文件和目录,然后重建内部的数据结构。
selectfont
This element is used to black/white list fonts from being listed or matched against. It holds acceptfont and rejectfont elements.
这个元素用来设定黑名单或白名单,指示哪些字型该列出给应用程序,以及哪些字型可供比对。
acceptfont
Fonts matched by an acceptfont element are "whitelisted"; such fonts are explicitly included in the set of fonts used to resolve list and match requests; including them in this list protects them from being "blacklisted" by a rejectfont element. Acceptfont elements include glob and pattern elements which are used to match fonts.
在acceptfont元素里比对到的字型会被列入「白名单」内;这种字型会被列出给应用程序,而且可供比对;在白名单内的字型不会被rejectfont元素列入黑名单。 acceptfont元素包含多个glob和pattern元素,用来比对字型。
rejectfont
Fonts matched by an rejectfont element are "blacklisted"; such fonts are excluded from the set of fonts used to resolve list and match requests as if they didn't exist in the system. Rejectfont elements include glob and pattern elements which are used to match fonts.
rejectfont元素里比对到的字型会被列入黑名单内;这类的字型既不会列出给应用程序,也不会被拿来比对,就好像该字列不存在于系统中一样。 rejectfont元素包含多个glob和pattern元素,用来比对字型。
glob
Glob elements hold shell-style filename matching patterns (including ? and *) which match fonts based on their complete pathnames. This can be used to exclude a set of directories (/usr/share/fonts/uglyfont*), or particular font file types (*.pcf.gz), but the latter mechanism relies rather heavily on filenaming conventions which can't be relied upon.
glob元素容纳多个shell下完整路径的文件名比对方式(可以包含?和*)。这可以用来排除一整套目录(/usr/share/fonts/uglyfont*),或特定的字型文件格式(*.pcf.gz),然而使用附档名的方法,依赖的是不可靠的档案命名系统。
pattern
Pattern elements perform list-style matching on incoming fonts; that is, they hold a list of elements and associated values. If all of those elements have a matching value, then the pattern matches the font. This can be used to select fonts based on attributes of the font (scalable, bold, etc), which is a more reliable mechanism than using file extensions. Pattern elements include patelt elements.
pattern元素把进来的字型和样式需求一一比较;也就是说,它容纳了一系列的元素及其值。如果每个元素里都有一个值佮好与进来的字型相符,代表进来的字型和这整个样式相符。依属性(可缩放、粗体等)比对字型时,就会用到这个功能,这种方法比依赖附档名可靠多了。 pattern元素包含多个patelt元素。
patelt name="property"
Patelt elements hold a single pattern element and list of values. They must have a 'name' attribute which indicates the pattern element name. Patelt elements include int, double, string, matrix, bool, charset and const elements.
patelt name="property"元素容纳多个constant元素,constant再转而容纳一个下列元素:int|double|string|matrix|bool|charset|const。 patelt name="property"元素必须要指定属性name,表示对应于何种字型性质。
match target="pattern"
This element holds first a (possibly empty) list of test elements and then a (possibly empty) list of edit elements. Patterns which match all of the tests are subjected to all the edits. If 'target' is set to "font" instead of the default "pattern", then this element applies to the font name resulting from a match rather than a font pattern to be matched.
这个元素容纳一系列的test元素(也可以不含test),接着是一系列的edit元素(也可以不含)。符合所有test的字型样式,会按照edit里的指令逐一修改。如果设定「match target="font"」,表示一系列的修改只针对选出的字型的样式名称。预设的「match target="pattern"」表示更改的是字型样式需求。(译注:还记得字型样式共修订两次吗?一次在和选出字型之前,一次在选出字型之后。)
test qual="any" name="property" target="default" compare="eq"
This element contains a single value which is compared with the target ('pattern', 'font' or 'default') property "property" (substitute any of the property names seen above). 'compare' can be one of "eq", "not_eq", "less", "less_eq", "more", or "more_eq". 'qual' may either be the default, "any", in which case the match succeeds if any value associated with the property matches the test value, or "all", in which case all of the values associated with the property must match the test value. When used in a <match target="font"> element, the target= attribute in the <test> element selects between matching the original pattern or the font. "default" selects whichever target the outer <match> element has selected.
这个元素容纳一个值,跟target(可以是"pattern", "font", "default")的某一性质比较,性质property可以是上面「字型的性质」里提到的任何一种。compare可以设为下列之一:"eq"、"not_eq"、"less"、"less_eq"、"more"、或"more_eq"。 qual可以是预设的"any",代表当样式里任一个性质符合测试值的时候就算符合;也可以是"all",代表当样式里每一个性质都符合测试值的时候才算符合。如果这个<test>在<match target="font">里面,<test>里的target可以设定为测试原本的样式需求(pattern),也可以设定为测试选出来的字型(font)。设为default代表和外面的<match target="pattern/font">用同一个设定。
edit name="property" mode="assign" binding="weak"
This element contains a list of expression elements (any of the value or operator elements). The expression elements are evaluated at run-time and modify the property "property". The modification depends on whether "property" was matched by one of the associated test elements, if so, the modification may affect the first matched value. Any values inserted into the property are given the indicated binding ("strong", "weak" or "same") with "same" binding using the value from the matched pattern element. 'mode' is one of:
Mode With Match Without Match
---------------------------------------------------------------------
"assign" Replace matching value Replace all values
"assign_replace" Replace all values Replace all values
"prepend" Insert before matching Insert at head of list
"prepend_first" Insert at head of list Insert at head of list
"append" Append after matching Append at end of list
"append_last" Append at end of list Append at end of list
这个元素容纳一系列的元素表示式(以值和算子构成)。程序执行时才计算这些表示式,并以计算结果修改性质"property"。随着样式是否符合某一个test条件,修改方式也不同,如果有一个值符合,就修改符合的第一个。每一个插入值都有一个约束("strong", "weak", 或"same"),其中的"same"代表使用符合的样式元素的约束。 mode意义如下:
Mode 符合其一 全不符合
---------------------------------------------------------------------
"assign" 取代符合的值 取代所有的值
"assign_replace" 取代所有的值 取代所有的值
"prepend" 插在符合的值之前 插在所有的值之前
"prepend_first" 插在所有的值之前 插在所有的值之前
"append" 插在符合的值之后 插在所有的值之后
"append_last" 插在所有的值之后 插在所有的值之后
int, double, string, bool
These elements hold a single value of the indicated type. bool elements hold either true or false. An important limitation exists in the parsing of floating point numbers -- fontconfig requires that the mantissa start with a digit, not a decimal point, so insert a leading zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5 instead of -.5).
这些元素容纳同型态的单一数值。 bool容纳的是真或伪。浮点数有重要的限制:fontconfig只能接受以数字开头的尾数,不可以是小数点,所以遇到纯小数时请在开头插入零。 (也就是说接受0.5而非.5,以及接受-0.5而非-.5)。
matrix
This element holds the four double elements of an affine transformation.
这个元素容纳四个double元素,作为仿射转换的四个系数。
name
Holds a property name. Evaluates to the first value from the property of the font, not the pattern.
这个元素容纳一个性质名称。执行时会算作是字型里性质的第一个值。 (不适用于样式需求的性质。)
const
Holds the name of a constant; these are always integers and serve as symbolic names for common font values:
Constant Property Value
-------------------------------------
thin weight 0
extralight weight 40
ultralight weight 40
light weight 50
book weight 75
regular weight 80
normal weight 80
medium weight 100
demibold weight 180
semibold weight 180
bold weight 200
extrabold weight 205
black weight 210
heavy weight 210
roman slant 0
italic slant 100
oblique slant 110
ultracondensed width 50
extracondensed width 63
condensed width 75
semicondensed width 87
normal width 100
semiexpanded width 113
expanded width 125
extraexpanded width 150
ultraexpanded width 200
proportional spacing 0
dual spacing 90
mono spacing 100
charcell spacing 110
unknown rgba 0
rgb rgba 1
bgr rgba 2
vrgb rgba 3
vbgr rgba 4
none rgba 5
hintnone hintstyle 0
hintslight hintstyle 1
hintmedium hintstyle 2
hintfull hintstyle 3
这个元素容纳一个常数的名字;这些名字都是整数型态的性质及其值,是常用的字型数值:
Constant Property Value
-------------------------------------
thin weight 0
extralight weight 40
ultralight weight 40
light weight 50
book weight 75
regular weight 80
normal weight 80
medium weight 100
demibold weight 180
semibold weight 180
bold weight 200
extrabold weight 205
black weight 210
heavy weight 210
roman slant 0
italic slant 100
oblique slant 110
ultracondensed width 50
extracondensed width 63
condensed width 75
semicondensed width 87
normal width 100
semiexpanded width 113
expanded width 125
extraexpanded width 150
ultraexpanded width 200
proportional spacing 0
dual spacing 90
mono spacing 100
charcell spacing 110
unknown rgba 0
rgb rgba 1
bgr rgba 2
vrgb rgba 3
vbgr rgba 4
none rgba 5
hintnone hintstyle 0
hintslight hintstyle 1
hintmedium hintstyle 2
hintfull hintstyle 3
or, and, plus, minus, times, divide
These elements perform the specified operation on a list of expression elements. or and and are boolean, not bitwise.
这些元素对一列的表示式元素执行运算。 or以及and是普通的布尔运算,不是逐位的布尔运算。
eq, not_eq, less, less_eq, more, more_eq
These elements compare two values, producing a boolean result.
这些元素比较两个值,产生一个布尔代数结果。
not
Inverts the boolean sense of its one expression element
para> 对容纳的一个表示式做布尔代数中的反运算。
if
This element takes three expression elements; if the value of the first is true, it produces the value of the second, otherwise it produces the value of the third.
这个元素容纳三个表示式元素;如果第一个表示式为真,则产出的结果为第二个表示式的值,不然的话产生的是第三个的值。
alias
Alias elements provide a shorthand notation for the set of common match operations needed to substitute one font family for another. They contain a family element followed by optional prefer, accept and default elements. Fonts matching the family element are edited to prepend the list of prefered families before the matching family, append the acceptable familys after the matching family and append the default families to the end of the family list.
代换字族名称时,原本需要一连串match元素,我们可以运用alias元素来缩短记法。 alias容纳一个family元素,接着prefer、accept和default元素(可以不接)。若样式的字族名称符合family,那么就会在符合的字族名称前面插入prefer容纳的部份,在符合的名称后面插入accept容纳的部份,而在字族名列表的最后插入default容纳的部份。
family
Holds a single font family name
这个元素容纳一个字族名称。
prefer, accept, default
These hold a list of family elements to be used by the alias element. /article
这些元素容纳一系列的family元素,供alias元素使用。 /article
设定文件范例
系统设定文件
This is an example of a system-wide configuration file
以下是系统全域设定文件的范例。
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /usr/local/etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>
<!--
Find fonts in these directories
在下面的目录寻找字型。
-->
<dir>/usr/share/fonts</dir>
<dir>/usr/X11R6/lib/X11/fonts</dir>
<!--
Accept deprecated 'mono' alias, replacing it with 'monospace'
将不被认可的「mono」别名,替换为「monospace」。
-->
<match target="pattern">
<test qual="any" name="family"><string>mono</string></test>
<edit name="family" mode="assign"><string>monospace</string></edit>
</match>
<!--
Names not including any well known alias are given 'sans'
没有包含任何著名别名的字型名称,以「sans」为名称附于其后。
-->
<match target="pattern">
<test qual="all" name="family" mode="not_eq">sans</test>
<test qual="all" name="family" mode="not_eq">serif</test>
<test qual="all" name="family" mode="not_eq">monospace</test>
<edit name="family" mode="append_last"><string>sans</string></edit>
</match>
<!--
Load per-user customization file, but don't complain
if it doesn't exist
加载使用者各别的自订设定档,如果档案不存在也不用发出提醒。
-->
<include ignore_missing="yes">~/.fonts.conf</include>
<!--
Load local customization files, but don't complain
if there aren't any
加载本地自订设定档,如果档案不存在也不用发出提醒。
-->
<include ignore_missing="yes">conf.d</include>
<include ignore_missing="yes">local.conf</include>
<!--
Alias well known font names to available TrueType fonts.
These substitute TrueType faces for similar Type1
faces to improve screen appearance.
把计算机里有的TrueType字型当作著名字型的别名。
下面用TrueType字型代换相似的Type1字型,以加强屏幕显示效果。
-->
<alias>
<family>Times</family>
<prefer><family>Times New Roman</family></prefer>
<default><family>serif</family></default>
</alias>
<alias>
<family>Helvetica</family>
<prefer><family>Arial</family></prefer>
<default><family>sans</family></default>
</alias>
<alias>
<family>Courier</family>
<prefer><family>Courier New</family></prefer>
<default><family>monospace</family></default>
</alias>
<!--
Provide required aliases for standard names
Do these after the users configuration file so that
any aliases there are used preferentially
对标准字族名称起别名。
为了要让个人设定文件里的字型别名更为优先选到,以下的设定放在个人设定档后。
-->
<alias>
<family>serif</family>
<prefer><family>Times New Roman</family></prefer>
</alias>
<alias>
<family>sans</family>
<prefer><family>Arial</family></prefer>
</alias>
<alias>
<family>monospace</family>
<prefer><family>Andale Mono</family></prefer>
</alias>
</fontconfig>
使用者设定档
This is an example of a per-user configuration file that lives in ~/.fonts.conf
底下是使用者字型设定文件的例子,内容存放于~/.fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- ~/.fonts.conf for per-user font configuration 使用者个别字型设定 -->
<fontconfig>
<!--
Private font directory
个人字型目录
-->
<dir>~/.fonts</dir>
<!--
use rgb sub-pixel ordering to improve glyph appearance on
LCD screens. Changes affecting rendering, but not matching
should always use target="font".
次像素平滑化设定屏幕为rgb排法,加强字体的显示效果。因为这个属于画字的层面,
而不在于比对字型,所以使用target="font"。
-->
<match target="font">
<edit name="rgba" mode="assign"><const>rgb</const></edit>
</match>
</fontconfig>
档案
fonts.conf contains configuration information for the fontconfig library consisting of directories to look at for font information as well as instructions on editing program specified font patterns before attempting to match the available fonts. It is in xml format.
fonts.conf 含有针对fontconfig函式库的设定信息,包括了含有字型信息的目录,以及比对字型之前修订字型需求样式的指令。此档案采用XML格式。
conf.d is the conventional name for a directory of additional configuration files managed by external applications or the local administrator. The filenames starting with decimal digits are sorted in lexicographic order and used as additional configuration files. All of these files are in xml format. The master fonts.conf file references this directory in an <include> directive.
conf.d :依惯例,conf.d是额外设定文件所存放的目录,这些额外的设定文件通常由外部程序或计算机管理员管理。文件名以数字开头的档案按照字典方法排序后,依额外设定档处理。这些档案都采用XML格式。主要设定档fonts.conf利用<include>指示fontconfig读取conf.d。
fonts.dtd is a DTD that describes the format of the configuration files.
fonts.dtd 是定义设定档格式的DTD。
~/.fonts.conf is the conventional location for per-user font configuration, although the actual location is specified in the global fonts.conf file.
~/.fonts.conf :惯例上~/.fonts.conf是每个使用者各自的字型设定文件。这是由全域的fonts.conf所指定的。
~/.fonts.cache-* is the conventional repository of font information that isn't found in the per-directory caches. This file is automatically maintained by fontconfig.
~/.fonts.cache-* 惯例上是所有字型信息的快取文件,若各别目录有快取文件则不存放该目录的信息。此档案由fontconfig自动维护。
请参阅
fc-cache(1), fc-match(1), fc-list(1)
版本编号
Fontconfig version 2.3.2 |
|