Next: , Previous: , Up: Top   [Contents][Index]


5 Fonts

Lisp font object allows manipulation of correspondig X11 fonts.

Function: fontp arg

Returns t if arg is a font object.

Sawfish supports three “types” of fonts: X11 old core fonts (fontsets and fontstructs), Xft fonts, and if supported, Pango fonts. In lisp, type is represented by a string, "xlfd", "Xft", or "Pango".

Function: font-type-exists-p type

Returns true if fonts of type are available, false otherwise.

Function: get-font-typed type name

Returns a font object which represents an X11 font. It’s specified by the string name, and string type. Signals an error if the specified font is not available.

“Safe” examples are:

(get-font-typed "xlfd" "fixed")
(get-font-typed "Xft" "Sans")
(get-font-typed "Pango" "Sans")
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, in string, of the X11 font represented by object font.

Function: font-type font

Returns the font’s type. It is one of "xlfd", "Xft", and "Pango".

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.


Next: , Previous: , Up: Top   [Contents][Index]