W3cubDocs

/Elisp

Looking Up Fonts

Function: x-list-fonts name &optional reference-face frame maximum width

This function returns a list of available font names that match name. name should be a string containing a font name in either the Fontconfig, GTK+, or XLFD format (see Fonts in The GNU Emacs Manual). Within an XLFD string, wildcard characters may be used: the ‘*’ character matches any substring, and the ‘?’ character matches any single character. Case is ignored when matching font names.

If the optional arguments reference-face and frame are specified, the returned list includes only fonts that are the same size as reference-face (a face name) currently is on the frame frame.

The optional argument maximum sets a limit on how many fonts to return. If it is non-nil, then the return value is truncated after the first maximum matching fonts. Specifying a small value for maximum can make this function much faster, in cases where many fonts match the pattern.

The optional argument width specifies a desired font width. If it is non-nil, the function only returns those fonts whose characters are (on average) width times as wide as reference-face.

Function: x-family-fonts &optional family frame

This function returns a list describing the available fonts for family family on frame. If family is omitted or nil, this list applies to all families, and therefore, it contains all available fonts. Otherwise, family must be a string; it may contain the wildcards ‘?’ and ‘*’.

The list describes the display that frame is on; if frame is omitted or nil, it applies to the selected frame’s display (see Input Focus).

Each element in the list is a vector of the following form:

[family width point-size weight slant
 fixed-p full registry-and-encoding]

The first five elements correspond to face attributes; if you specify these attributes for a face, it will use this font.

The last three elements give additional information about the font. fixed-p is non-nil if the font is fixed-pitch. full is the full name of the font, and registry-and-encoding is a string giving the registry and encoding of the font.

Copyright © 1990-1996, 1998-2019 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Font-Lookup.html