/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>
|
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等元素,次序不限。
This element contains a directory name which will be scanned for font files to include in the set of available fonts.
這個元素容納一個目錄名稱,存放在此的字型檔會被當作是可以使用的字型。
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)。
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不會為之產生警示訊息。
This element provides a place to consolodate additional configuration information. config can contain blank and rescan elements in any order.
這個元素用來存放其它的設定資訊。 config可容納多個blank和rescan元素,順序不限。
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編碼。 不包含在這裡的字元如果畫起來還是空白的,就會被當作不被此字型支援的字元。
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在指定的時間過後會檢查所有的設定檔和目錄,然後重建內部的資料結構。
This element is used to black/white list fonts from being listed or matched against. It holds acceptfont and rejectfont elements.
這個元素用來設定黑名單或白名單,指示哪些字型該列出給應用程式,以及哪些字型可供比對。
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元素,用來比對字型。
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 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 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 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,表示對應於何種字型性質。
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"」表示更改的是字型樣式需求。(譯註:還記得字型樣式共修訂兩次嗎?一次在和選出字型之前,一次在選出字型之後。)
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">用同一個設定。
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" 插在所有的值之後 插在所有的值之後
|
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容納的是true或false。[註: true, on, 1, yes, t*, y*, 1*, on* 等等都是真值; false, off, 0, no, f*, n*, 0*, of* 等等都是偽值。] 浮點數有重要的限制:fontconfig只能接受以數字開頭的尾數,不可以是小數點,所以遇到純小數時請在開頭插入零。 (也就是說接受0.5而非.5,以及接受-0.5而非-.5)。
This element holds the four double elements of an affine transformation.
這個元素容納四個double元素,作為仿射轉換的四個係數。
Holds a property name. Evaluates to the first value from the property of the font, not the pattern.
這個元素容納一個性質名稱。 執行時會算作是字型裡性質的第一個值。 (不適用於樣式需求的性質。)
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
|
These elements perform the specified operation on a list of expression elements. or and and are boolean, not bitwise.
這些元素對一列的表示式元素執行運算。 or以及and是普通的布爾運算,不是逐位元的布爾運算。
These elements compare two values, producing a boolean result.
這些元素比較兩個值,產生一個布爾代數結果。
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 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容納的部份。
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自動維護。