1--- 2Title: Fonts and Glyphs 3--- 4 5# Fonts 6 7Pango supports a flexible architecture where a particular rendering architecture 8can supply an implementation of fonts. The `PangoFont` structure represents an 9abstract rendering-system-independent font. Pango provides routines to list 10available fonts, and to load a font matching a given description. 11 12Conceptually, Pango groups fonts into faces and families which are identified 13by a name. A *font face* provides the different sizes of a single font style. 14A *font family* provides the available styles of a font. 15 16As an example, "Helvetica" is a family, "Helvetica Bold" is a face of this 17family, and "Helvetica Bold 12pt" is a concrete font of this face. 18 19# Font Enumeration 20 21The central object for dealing with the available fonts on a system and caching 22loaded fonts is a [class@Pango.FontMap]. An application typically uses a single 23font map. 24 25Since the font map depends on the rendering architecture in use, you'll need to 26use the backend function pango_cairo_font_map_get_default() to obtain the default 27fontmap. Depending on the platform, it will return a `PangoCairoFcFontMap`, a 28`PangoCairoWin32FontMap` or a `PangoCairoCoreTextFontMap`. 29 30Once you have a fontmap, you can enumerate the available font families with 31[method@Pango.FontMap.list_families]. To enumerate the faces of a font family, 32use [method@Pango.FontFamily.list_faces]. 33 34# Font Descriptions 35 36Since loading fonts uses system resources, Pango provides a way to describe 37a font without loading it. A [struct@Pango.FontDescription] is a struct that 38contains enough information to load a concrete font with 39[method@Pango.FontMap.load_font] or [method@Pango.Context.load_font]. You can 40obtain a font description from a font face using [method@Pango.FontFace.describe], 41or by parsing a string such as 42 43 Helvetica Bold 12pt 44 45with [func@Pango.FontDescription.from_string]. 46 47# Glyphs 48 49A font provides information about glyphs and how to position and render them. 50The Pango rendering pipeline uses this information to create a 51[struct@Pango.GlyphString], which contains the glyphs corresponding to the 52characters in the text and related information such as glyph positions and sizes, 53and clustering information (i.e. which glyphs correspond to which characters). 54 55![A glyph string](rects3.png) 56 57A glyph is identified by a [alias@Pango.Glyph], which is a numeric ID. Note that 58glyph IDs are font-specific: the same character can be represented by diffferent 59glyph IDs in different fonts. 60 61The mapping between characters and glyphs is in general neither 1-1 nor a map: 62a single glyph may represent multiple characters (as is the case with ligatures), 63a single character may be represented by multiple glyphs (for example, when 64combining accents and base character), and in complex scripts, multiple characters 65may form clusters that get rearranged and represented by multiple glyphs. 66