www.delorie.com/gnu/docs/elisp-manual-21/elisp_640.html   search  
Buy the book!

GNU Emacs Lisp Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

38.11.9 Looking Up Fonts

Function: x-list-fonts pattern &optional face frame maximum
This function returns a list of available font names that match pattern. If the optional arguments face and frame are specified, then the list is limited to fonts that are the same size as face currently is on frame.

The argument pattern should be a string, perhaps with wildcard characters: the `*' character matches any substring, and the `?' character matches any single character. Pattern matching of font names ignores case.

If you specify face and frame, face should be a face name (a symbol) and frame should be a frame.

The optional argument maximum sets a limit on how many fonts to return. If this 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.

These additional functions are available starting in Emacs 21.

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 section 29.9 Input Focus).

The list contains a vector of the following form for each font:

[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.

The result list is sorted according to the current face font sort order.

Function: x-font-family-list &optional frame
This function returns a list of the font families available for frame's display. If frame is omitted or nil, it describes the selected frame's display (see section 29.9 Input Focus).

The value is a list of elements of this form:

(family . fixed-p)

Here family is a font family, and fixed-p is non-nil if fonts of that family are fixed-pitch.

Variable: font-list-limit
This variable specifies maximum number of fonts to consider in font matching. The function x-family-fonts will not return more than that many fonts, and font selection will consider only that many fonts when searching a matching font for face attributes. The default is currently 100.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003