|
楼主 |
发表于 2003-3-29 23:08:36
|
显示全部楼层
Configuration File Format
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.
The fontconfig document type definition resides in the external entity "fonts.dtd"; this is normally stored in the default font configuration directory (/etc/fonts). Each configuration file should contain the following structure:
- <?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
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).
include ignore_missing="no"
This element contains the name of an additional configuration file. When the XML datatype is traversed by FcConfigParse, the contents of the file will also be incorporated into the configuration by passing the filename to FcConfigLoadAndParse. If 'ignore_missing' is set to "yes" instead of the default "no", a missing file will elicit no warning message from the library.
config
This element provides a place to consolodate additional configuration information. config can contain blank and rescan elements in any order.
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.
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.
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 qual="any" name="property" compare="eq"
This element contains a single value which is compared with the pattern 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.
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. '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
复制代码
int, double, string, bool
These elements hold a single value of the indicated type. bool elements hold either true or false.
matrix
This element holds the four double elements of an affine transformation.
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
- -------------------------------------
- light weight 0
- medium weight 100
- demibold weight 180
- bold weight 200
- black weight 210
- roman slant 0
- italic slant 100
- oblique slant 110
- proportional spacing 0
- mono spacing 100
- charcell spacing 110
- unknown rgba 0
- rgb rgba 1
- bgr rgba 2
- vrgb rgba 3
- vbgr rgba 4
- none rgba 5
复制代码
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.
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
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.
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 |
|