[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Selecting a font means mapping the specified face attributes for a character to a font that is available on a particular display. The face attributes, as determined by face merging, specify most of the font choice, but not all. Part of the choice depends on what character it is.
For multibyte characters, typically each font covers only one
character set. So each character set (see section 33.5 Character Sets) specifies
a registry and encoding to use, with the character set's
x-charset-registry
property. Its value is a string containing
the registry and the encoding, with a dash between them:
(plist-get (charset-plist 'latin-iso8859-1) 'x-charset-registry) => "ISO8859-1" |
Unibyte text does not have character sets, so displaying a unibyte
character takes the registry and encoding from the variable
face-default-registry
.
If the face specifies a fontset name, that fontset determines a pattern for fonts of the given charset. If the face specifies a font family, a font pattern is constructed.
Emacs tries to find an available font for the given face attributes and character's registry and encoding. If there is a font that matches exactly, it is used, of course. The hard case is when no available font exactly fits the specification. Then Emacs looks for one that is "close"---one attribute at a time. You can specify the order to consider the attributes. In the case where a specified font family is not available, you can specify a set of mappings for alternatives to try.
:width
, :height
, :weight
, and :slant
. The
value should be a list containing those four symbols, in order of
decreasing importance.
Font selection first finds the best available matches for the first attribute listed; then, among the fonts which are best in that way, it searches for the best matches in the second attribute, and so on.
The attributes :weight
and :width
have symbolic values in
a range centered around normal
. Matches that are more extreme
(farther from normal
) are somewhat preferred to matches that are
less extreme (closer to normal
); this is designed to ensure that
non-normal faces contrast with normal ones, whenever possible.
The default is (:width :height :weight :slant)
, which means first
find the fonts closest to the specified :width
, then--among the
fonts with that width--find a best match for the specified font height,
and so on.
One example of a case where this variable makes a difference is when the
default font has no italic equivalent. With the default ordering, the
italic
face will use a non-italic font that is similar to the
default one. But if you put :slant
before :height
, the
italic
face will use an italic font, even if its height is not
quite right.
(family alternate-families...) |
If family is specified but not available, Emacs will try the other families given in alternate-families, one by one, until it finds a family that does exist.
(registry alternate-registries...) |
If registry is specified but not available, Emacs will try the other registries given in alternate-registries, one by one, until it finds a registry that does exist.
Emacs can make use of scalable fonts, but by default it does not use them, since the use of too many or too big scalable fonts can crash XFree86 servers.
nil
, the default, means do not use scalable fonts. t
means to use any scalable font that seems appropriate for the text.
Otherwise, the value must be a list of regular expressions. Then a scalable font is enabled for use if its name matches any regular expression in the list. For example,
(setq scalable-fonts-allowed '("muleindian-2$")) |
allows the use of scalable fonts with registry muleindian-2
.
nil
, that means to unload
all unused fonts as well.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |