Next: , Previous: Colors, Up: Top


5 Fonts

As with the color type, the font type allows X11 fonts to be manipulated by Lisp code.

— Function: fontp arg

Returns t if arg is a font object.

Sawfish supports two types of fonts: X11 core fonts (fontsets and fontstructs) and Xft fonts. Calling code must look up fonts by giving both a name and a type: an "xlfd" argument indicates the core fonts, and "Xft" indicates Xft fonts. These types are always literal strings.

— Function: font-type-exists-p type

Returns true if fonts with the type described by the string type can be loaded, false otherwise.

— Function: get-font-typed type name

Return a font object representing the X11 font specified by the string name. Argument type indicates the type of font to look for; it must be one of the strings "xlfd" for a X11 core fonts (based on fontsets or a fontstructs), or "Xft" for an Xft font.

Signals an error if type is not one of the literal strings listed above. Also signals an error if no font named name can be found within the requested type.

— Function: get-font name

Return a font object representing the X11 core font (fontset or fontstruct) specified by the string name.

Signals an error if no font named name is available among the X11 core fonts.

Several functions allow the attributes associated with a font object to be found.

— Function: font-name font

Returns the name of the X11 font represented by object font (a string).

— Function: font-type font

Returns a string indicating the font's class. This is "xlfd" for X11 core fonts, or "Xft" for Xft fonts.

— Function: font-height font

Returns the bounding height of glyphs in the font represented by object font.

— Function: font-ascent &optional font

Returns the ascent of glyphs rendered using the font represented by font. If no font argument is given, use the default font.

— Function: font-descent &optional font

Returns the descent of glyphs rendered using the font represented by font. If no font argument is given, use the default font.

— Function: text-width string &optional font

Returns the number of horizontal pixels that would be required to display the text string using font object font (or the value of the default-font variable if font is undefined).

As with colors, a default font may be specified, to be used where no other font is specified.

— Variable: default-font

Font object used when no other font has been specified.

Fonts can have Lisp properties associated with them (similar to the property lists associated with symbols). Currently these aren't actually used by the window manager.

— Function: font-put font property value

Associate the lisp object value with the property named by the symbol property of the font object font.

— Function: font-get font property

Return the value of the property named by the symbol property of the font font, or nil if no such property exists.

— Variable: fonts-are-fontsets

True if the X fonts in use are fontsets. This will be false if setlocale fails, or returns an ASCII locale, or if X doesn't support the locale.