src/swipl-devel/packages/xpce/man/refmanual/md/font.md

class font {#class-font}

A font describes the appearance of a run of text. An xpce font has four characteristics:

xpce uses Pango for everything below the xpce API: family resolution, glyph layout, hinting and rendering. Application code normally refers to a font by its alias name held in the @font_aliases hash table — for instance:

send(Editor, font, normal).

The aliases are seeded from the font.system_fonts and (when present) font.user_fonts class variables. See <-convert for the accepted name forms.

The xpce <-family slot is translated to a Pango family by looking the name up in the @font_families hash table (seeded from font.pango_families). That table maps the generic family names mono, sans and serif to a sensible platform-specific Pango family; any name not in the table is passed to Pango literally. A Pango family name may itself be a comma-separated list of alternatives that Pango tries in order; <-pango_property reports which family was actually selected.

Fonts are reusable: constructing one with the same family, style, points and weight returns the existing instance (see <-lookup). Font objects are auto-bound to a global reference of the form @<family>_<style>_<points> for convenient debugging access.

A sheet describing every Pango font on the host is available as

get(class(font), font_families, Sheet).

xpce text manipulation handles both fixed-width and proportional fonts. Many classes ship class variables that pick reasonable default fonts for their role.

@see text<-font @see class fragment @see class editor @see class text_image

Class variables {#class-font-classvars}

Instance variables {#class-font-instvars}

Send methods {#class-font-send}

Get methods {#class-font-get}



Try the rswipl package in your browser

Any scripts or data that you put into this service are public.

rswipl documentation built on June 16, 2026, 5:07 p.m.