Up: cl-cffi-gtk4 API documentation

Package pango

Pango is a text layout and shaping library. Pango facilitates the layout and shaping of multi-language text. Full-function rendering of text and cross-platform support is had when Pango is used with platform APIs or 3rd party libraries, such as Uniscribe and FreeType, as text rendering backends. Pango-processed text will appear similar under different operating systems. This is the API documentation of a Lisp binding to Pango.

About This Package

Basic Pango Interfaces
Rendering with Pango
Low Level Functionality
Utilities

Basic Pango Interfaces


Rendering

The Pango rendering pipeline takes a string of Unicode characters and converts it into glyphs. The functions described in this section accomplish various steps of this process.
Flags influencing the shaping process. ...

The pango:analysis structure stores information about the properties of a segment of text. ...

Accessor of the font slot of the pango:analysis structure. ...

Accessor of the level slot of the pango:analysis structure. ...

Accessor of the gravity slot of the pango:analysis structure. ...

Accessor of the flags slot of the pango:analysis structure. ...

Accessor of the script slot of the pango:analysis structure. ...

Accessor of the language slot of the pango:analysis structure. ...

Accessor of the extra-attrs slot of the pango:analysis structure. ...

The pango:item structure stores information about a segment of text. ...

Accessor of the analysis slot of the pango:item structure. ...

Accessor of the length slot of the pango:item structure. ...

Accessor of the num-chars slot of the pango:item structure. ...

Accessor of the offset slot of the pango:item structure. ...

Creates a new pango:item instance initialized to default values. ...

Copy an existing pango:item instance. ...

Modifies item to cover only the text after index, and returns a new item that covers the text before index that used to be in item. ...

Add attributes to a pango:item instance. ...

Breaks a piece of text into segments with consistent directional level and shaping engine. ...

Like the pango:itemize function, but the base direction to use when computing bidirectional levels, is specified explicitly rather than gotten from the pango:context object. ...

Given a segment of text and the corresponding pango:analysis instance returned from the pango:itemize function, convert the characters into glyphs. ...

Given a segment of text and the corresponding pango:analysis instance returned from the pango:itemize function, convert the characters into glyphs. ...

Given a segment of text and the corresponding pango:analysis instance returned from the pango:itemize function, convert the characters into glyphs. ...


PangoFontDescription

An enumeration specifying the various slant styles possible for a font. ...

An enumeration specifying the weight (boldness) of a font. ...

An enumeration specifying capitalization variant of the font. ...

An enumeration specifying the width of the font relative to other designs within a family. ...

The bits correspond to fields in a pango:font-description instance that have been set. ...

The pango:font-description structure represents the description of an ideal font. ...

Creates a new font description instance with all fields unset. ...

Makes a copy of a font description. ...

Computes a hash of a font description. ...

Compares two font descriptions for equality. ...

The pango:font-description-family function gets the family name field of a font description. ...

The pango:font-description-style function gets the style field of a font description instance. ...

The pango:font-description-variant function gets the variant field of a font description. ...

The pango:font-description-weight function gets the weight field of a font description. ...

The pango:font-description-stretch function gets the stretch field of a font description. ...

The pango:font-description-size function gets the size field of a font description in points or device units. ...

Sets the size field of a font description, in device units. ...

Determines whether the size of the font is in points (not absolute) or device units (absolute). ...

The pango:font-description-gravity function gets the gravity field of a font description. ...

The pango:font-description-variations function gets the variations field of a font description. ...

Determines which fields in a font description have been set. ...

Unsets some of the fields in a font description. ...

Merges the fields that are set in merge into the fields in desc. ...

Determines if the style attributes of new are a closer match for desc than those of old are, or if old is nil, determines if new is a match at all. ...

Creates a new font description from a string representation. ...

Creates a string representation of a font description. ...

Creates a filename representation of a font description. ...


PangoFontMetrics

A pango:font-metrics structure holds the overall metric information for a font, possibly restricted to a script. ...

Gets the ascent from a font metrics structure. ...

Gets the descent from a font metrics instance. ...

Gets the line height from a font metrics instance. ...

Gets the approximate character width for a font metrics instance. ...

Gets the approximate digit width for a font metrics instance. ...

Gets the suggested thickness to draw for the underline. ...

Gets the suggested position to draw the underline. ...

Gets the suggested thickness to draw for the strikethrough. ...

Gets the suggested position to draw the strikethrough. ...


Fonts

Pango supports a flexible architecture where a particular rendering architecture can supply an implementation of fonts. The pango:font class represents an abstract rendering-system-independent font. Pango provides routines to list available fonts, and to load a font of a given description.
The pango:font class is used to represent a font in a rendering-system-independent matter. ...

Returns a description of the font, with font size set in points. ...

Returns a description of the font, with absolute font size set, in device units. ...

Gets the Pango font face to which the given font belongs. ...

Computes the coverage map for a given font and language tag. ...

Returns true if font can render the given character. ...

Gets the logical and ink extents of a glyph within a font. ...

Gets overall metric information for a font. ...

Gets the font map for which the font was created. ...

Returns the languages that are supported by the font backend. ...

Serializes the font in a way that can be uniquely identified. ...

Loads data previously created via the pango:font-serialize function. ...

The pango:font-family class is used to represent a family of related font faces. ...

A monospace font is a font designed for text display where the characters form a regular grid. ...

A variable font is a font which has axes that can be modified to produce different faces. ...

Accessor of the item-type slot of the pango:font-family class. ...

Accessor of the n-items slot of the pango:font-family class. ...

Gets the name of the font family. ...

Lists the different font faces that make up family. ...

Gets the Pango font face of the given font family with the given name. ...

The pango:font-face class is used to represent a group of fonts with the same family, slant, weight, width, but varying sizes. ...

Gets a name representing the style of this face among the different faces in the pango:font-family for the face. ...

List the available sizes for a font. ...

Returns the family, style, variant, weight and stretch of a font face. ...

Returns whether a font face is synthesized by the underlying font rendering engine from another face, perhaps by shearing, emboldening, or lightening it. ...

Gets the Pango font family that the font face belongs to. ...

The pango:font-map class represents the set of fonts available for a particular rendering system. ...

Accessor of the item-type slot of the pango:font-map class. ...

Accessor of the n-items slot of the pango:font-map class. ...

Creates a Pango context connected to fontmap. ...

Load the font in the fontmap that is the closest match for desc. ...

Load a set of fonts in the fontmap that can be used to render a font matching desc. ...

List all families for a font map. ...

Gets a font family by name. ...

Returns the current serial number of fontmap. ...

Forces a change in the context, which will cause any pango:context object using this font map to change. ...

The pango:fontset object represents a set of pango:font objects to use when rendering text. ...

Returns the font in the fontset that contains the best glyph for the Unicode character char. ...

Get overall metric information for the fonts in the fontset. ...

A callback function used by the pango:fontset-foreach function when enumerating the fonts in a fontset. ...

Iterates through all the fonts in a fontset, calling func for each one. ...


Text Attributes

Attributed text is used in a number of places in Pango. It is used as the input to the itemization process and also when creating a Pango layout. The data types and functions in this section are used to represent and manipulate sets of attributes applied to a portion of text.

Types and functions for text attributes

The scale factor for three shrinking steps. ...

The scale factor for two shrinking steps. ...

The scale factor for one shrinking step. ...

The scale factor for normal size. ...

The scale factor for one magnification step. ...

The scale factor for two magnification steps. ...

The scale factor for three magnification steps. ...

The pango:attr-type enumeration distinguishes between different types of attributes. ...

The pango:underline enumeration is used to specify whether text should be underlined, and if so, the type of underlining. ...

The pango:overline enumeration is used to specify whether text should be overlined, and if so, the type of line. ...

These flags affect how Pango treats characters that are normally not visible in the output. ...

An enumeration that affects how Pango treats characters during shaping. ...

An enumeration that affects baseline shifts between runs. ...

An enumeration that affects font sizes for superscript and subscript positioning and for (emulated) Small Caps. ...

The pango:attribute structure represents the common portions of all attributes. ...

Accessor of the start-index slot of the pango:attribute structure. ...

Accessor of the end-index slot of the pango:attribute structure. ...

Accessor of the type slot of the pango:attribute structure. ...

Makes a copy of an attribute. ...

Compare two attributes for equality. ...

Allocates a new attribute type ID. ...

Fetches the attribute type name passed in when registering the type using the pango:attr-type-register function. ...

Creates a new language tag attribute. ...

Creates a new font family attribute. ...

Creates a new font slant style attribute. ...

Creates a new font variant attribute (normal or small caps). ...

Creates a new font stretch attribute. ...

Creates a new font weight attribute. ...

Creates a new font-size attribute in fractional points. ...

Creates a new font-size attribute in device units. ...

Create a new font description attribute. ...

Create a new foreground color attribute. ...

Create a new background color attribute. ...

Create a new strikethrough attribute. ...

Create a new strikethrough color attribute. ...

Create a new underline style attribute. ...

Create a new underline color attribute. ...

Create a new overline style attribute. ...

Create a new overline color attribute. ...

Creates a new shape attribute. ...

Create a new font size scale attribute. ...

Create a new baseline displacement attribute. ...

Create a new letter spacing attribute. ...

Create a new font fallback attribute. ...

Create a new gravity attribute. ...

Create a new gravity hint attribute. ...

Create a new font features tag attribute. ...

Create a new foreground alpha attribute. ...

Create a new background alpha attribute. ...

Create a new allow breaks attribute. ...

Create a new insert hyphens attribute. ...

Create a new attribute that influences how invisible characters are rendered. ...

The pango:attr-list structure represents a list of attributes that apply to a section of text. ...

Create a new empty attribute list. ...

Copy attrlist and return an identical new attribute list. ...

Checks whether listattr1 and listattr2 contain the same attributes and whether those attributes apply to the same ranges. ...

Insert the given attribute into the pango:attr-list instance. ...

Insert the given attribute into the pango:attr-list instance. ...

Insert the given attribute into the pango:attr-list instance. ...

This function opens up a hole in the attribute list, fills it in with attributes from the left, and then merges attrlist2 on top of the hole. ...

A predicate callback function used by the pango:attr-list-filter function to filter out a subset of attributes for an attribute list. ...

Given a attribute list and callback function, removes any elements of the attribute list for which func returns true and inserts them into a new attribute list. ...

Update indices of attributes in the attribute list for a change in the text they refer to. ...

Gets a list of all attributes in attrlist. ...

Deserializes a pango:attr-list instance from a string. ...

Serializes a pango-attr-list instance to a string. ...

Create an iterator initialized to the beginning of the attribute list. ...

The pango:attr-iterator structure is used to represent an iterator through a pango:attr-list instance. ...

Copy a pango:attr-iterator instance. ...

Advance the iterator until the next change of style. ...

Get the range of the current segment. ...

Find the current attribute of a particular type at the iterator location. ...

Get the font and other attributes at the current iterator position. ...

Gets a list of all attributes at the current position of the iterator. ...


Pango Markup

Simple markup language for text with attributes.

Frequently, you want to display some text to the user with attributes applied to part of the text. For example, you might want bold or italicized words. With the base Pango interfaces, you could create a pango:attr-list instance and apply it to the text. The problem is that you would need to apply attributes to some numeric range of characters, for example "characters 12-17." This is broken from an internationalization standpoint. Once the text is translated, the word you wanted to italicize could be in a different position.

The solution is to include the text attributes in the string to be translated. Pango provides this feature with a small markup language. You can parse a marked-up string into the string text plus a pango:attr-list instance using the pango:parse-markup function.

A simple example of a marked-up string might be:
<span foreground="blue" size="x-large">Blue text</span> is <i>cool</i>!      
Pango uses GMarkup to parse this language, which means that XML features such as numeric character entities such as &amp;#169; for © can be used too.

The root tag of a marked-up document is <markup>, but the pango:parse-markup function allows you to omit this tag, so you will most likely never need to use it. The most general markup tag is <span>, then there are some convenience tags.

Span attributes
<span> has the following attributes:
font_desc
A font description string, such as "Sans Italic 12". See the pango:font-description-from-string function for a description of the format of the string representation. Note that any other span attributes will override this description. So if you have "Sans Italic" and also a style="normal" attribute, you will get Sans normal, not italic.
font_family
A font family name.
font_size, size
Font size in 1024ths of a point, or one of the absolute sizes xx-small, x-small, small, medium, large, x-large, xx-large, or one of the relative sizes smaller or larger. If you want to specify a absolute size, it is usually easier to take advantage of the ability to specify a partial font description using font. You can use font='12.5' rather than size='12800'.
font_style
One of normal, oblique, italic.
font_weight
One of ultralight, light, normal, bold, ultrabold, heavy, or a numeric weight.
font_variant
One of normal or smallcaps.
font_stretch, stretch
One of ultracondensed, extracondensed, condensed, semicondensed, normal, semiexpanded, expanded, extraexpanded, ultraexpanded.
font_features
A comma-separated list of OpenType font feature settings, in the same syntax as accepted by CSS, e.g. font_features='dlig=1, -kern, afrc on'.
foreground, fgcolor
An RGB color specification such as #00FF00 or a color name such as red. An RGBA color specification such as #00FF007F will be interpreted as specifying both a foreground color and foreground alpha.
background, bgcolor
An RGB color specification such as #00FF00 or a color name such as red. An RGBA color specification such as #00FF007F will be interpreted as specifying both a background color and background alpha.
alpha, fgalpha
An alpha value for the foreground color, either a plain integer between 1 and 65536 or a percentage value like 50 %.
background_alpha, bgalpha
An alpha value for the background color, either a plain integer between 1 and 65536 or a percentage value like 50 %.
underline
One of none, single, double, low, error, single-line, double-line or error-line.
underline_color
The color of underlines. An RGB color specification such as #00FF00 or a color name such as red.
overline
One of none or single.
overline_color
The color of overlines. An RGB color specification such as #00FF00 or a color name such as red.
rise
Vertical displacement, in Pango units. Can be negative for subscript, positive for superscript.
strikethrough
True or false whether to strike through the text.
strikethrough_color
The color of strikethrough lines. An RGB color specification such as #00FF00 or a color name such as red.
fallback
True or false whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.
allow_breaks
True or false whether to allow line breaks or not. If not allowed, the range will be kept in a single run as far as possible. Breaks are allowed by default.
insert_hyphens
True or false whether to insert hyphens when breaking lines in the middle of a word. Hyphens are inserted by default.
show
A value determining how invisible characters are treated. Possible values are spaces, line-breaks, ignorables or combinations, such as spaces and line-breaks.
lang
A language code, indicating the text language.
letter_spacing
Inter-letter spacing in 1024ths of a point.
gravity
One of south, east, north, west, auto.
gravity_hint
One of natural, strong, line.
Convenience tags
The following convenience tags are provided:
<b>
Bold.
<big>
Makes font relatively larger, equivalent to <span size="larger">.
<i>
Italic.
<s>
Strikethrough.
<sub>
Subscript.
<sup>
Superscript.
<small>
Makes font relatively smaller, equivalent to <span size="smaller">.
<tt>
Monospace.
<u>
Underline.
Parses marked-up text to create a plain-text string and an attribute list. ...


Layout Objects

While complete access to the layout capabilities of Pango is provided using the detailed interfaces for itemization and shaping, using that functionality directly involves writing a fairly large amount of code. The objects and functions in this section provide a high-level driver for formatting entire paragraphs of text at once. This includes paragraph-level functionality such as line-breaking, justification, alignment and ellipsization.

Types and functions for PangoLayout

The pango:wrap-mode enumeration describes how to wrap the lines of a pango:layout object to the desired width. ...

The pango:ellipsize-mode enumeration describes what sort of (if any) ellipsization should be applied to a line of text. ...

The pango:alignment enumeration describes how to align the lines of a pango:layout object within the available space. ...

The pango:layout class represents an entire paragraph of text. ...

Create a new Pango layout with attributes initialized to default values for a particular pango:context object. ...

Does a deep copy-by-value of the Pango layout. ...

Retrieves the Pango context used for this Pango layout. ...

Forces recomputation of any state in the Pango layout that might depend on the Pango context of layout. ...

Returns the current serial number of the Pango layout. ...

The pango:layout-text function gets the text in the Pango layout. ...

Returns the number of Unicode characters in the text of the Pango layout. ...

Same as the pango:layout-set-markup-with-accel function, but the markup text is not scanned for accelerators. ...

Sets the layout text and attribute list from marked-up text (see markup format). ...

The pango:layout-attributes function gets the attribute list for the Pango layout, if any. ...

The pango:layout-font-description function gets the font description for the Pango layout. ...

The pango:layout-width function gets the width to which the lines of the Pango layout should wrap or ellipsized. ...

The pango:layout-height function gets the height of layout used for ellipsization. ...

The pango:layout-wrap function gets the wrap mode for the Pango layout. ...

Queries whether the Pango layout had to wrap any paragraphs. ...

The pango:layout-ellipsize function gets the type of ellipsization being performed for the Pango layout. ...

Queries whether the Pango layout had to ellipsize any paragraphs. ...

The pango:layout-indent function gets the paragraph indent width in Pango units. ...

The pango:layout-spacing function gets the amount of spacing in Pango units between the lines of the Pango layout. ...

The pango:layout-line-spacing function gets the value of the line spacing. ...

The pango:layout-justify function gets whether each complete line should be stretched to fill the entire width of the Pango layout. ...

The pango:layout-auto-dir function gets whether to calculate the bidirectional base direction for the Pango layout according to the contents of the Pango layout. ...

Gets the text direction at the given character position in the Pango layout. ...

The pango:layout-alignment function gets the alignment for the Pango layout. ...

The pango:layout-tabs function gets the current pango:tab-array instance used by this Pango layout. ...

If setting is true, do not treat newlines and similar characters as paragraph separators. ...

Counts the number of unknown glyphs in the Pango layout. ...

Converts from an index within a Pango layout to the onscreen position corresponding to the grapheme at that index, which is represented as the coordinates of a rectangle. ...

Converts from byte index within the Pango layout to line and xpos position. ...

Converts from x and y position within a Pango layout to the byte index of the character at that logical position. ...

Given an index within a Pango layout, determines the positions that of the strong and weak cursors if the insertion point is at that index. ...

Computes a new cursor position from an old position and a count of positions to move visually. ...

Computes the logical and ink extents of the Pango layout. ...

Computes the logical and ink extents of the Pango layout in device units. ...

Determines the logical width and height of a Pango layout in Pango units, device units scaled by the pango:+scale+ constant. ...

Determines the logical width and height of a Pango layout in device units. ...

Gets the y position of the baseline for the first line in the Pango layout. ...

Retrieves the count of lines for the Pango layout. ...

Retrieves a particular line from a Pango layout. ...

Retrieves a particular line from a Pango layout. ...

Returns the lines of the Pango layout as a list. ...

Returns the lines of the Pango layout as a list. ...


Type and functions for PangoLayoutIter

The pango:layout-iter structure can be used to iterate over the visual extents of a pango:layout object. ...

Returns an iterator to iterate over the visual extents of the Pango layout. ...

Copies a Pango layout iterator. ...

Moves iter forward to the next run in visual order. ...

Moves iter forward to the next character in visual order. ...

Moves iter forward to the next cluster in visual order. ...

Moves iter forward to the start of the next line. ...

Determines whether iter is on the last line of the Pango layout. ...

Gets the current byte index. ...

Gets the y position of the baseline of the current line, in Pango layout coordinates (origin at top left of the entire Pango layout). ...

Gets the current run. ...

Gets the current run. ...

Gets the current line. ...

Gets the current line for read-only access. ...

Gets the Pango layout associated with a Pango layout iterator. ...

Gets the logical extents of the current character, in Pango layout coordinates. ...

Gets the extents of the current cluster, in Pango layout coordinates, origin is the top left of the entire Pango layout. ...

Gets the extents of the current run in Pango layout coordinates (origin is the top left of the entire Pango layout). ...

Divides the vertical space in the Pango layout being iterated over between the lines in the Pango layout, and returns the space belonging to the current line. ...

Obtains the extents of the current line. ...

Obtains the extents of the Pango layout being iterated over. ...


Types and functions for PangoLayoutLine

The pango:layout-line structure represents one of the lines resulting from laying out a paragraph via a pango:layout object. ...

Computes the logical and ink extents of a Pango layout line. ...

Computes the height of the line, that is, the distance between this and the previous lines baseline. ...

Returns the length of the line, in bytes. ...

Computes the logical and ink extents of line in device units. ...

Returns the resolved direction of the line. ...

Returns the start index of the line, as byte index into the text of the layout. ...

Gets a list of visual ranges corresponding to a given logical range. ...

Converts an index within a line to a x position. ...

Returns whether this is the first line of the paragraph. ...

Converts from x offset to the byte index of the corresponding character within the text of the Pango layout. ...


Scripts and Languages

The pango:script enumeration identifies different writing systems. ...

The pango:language structure is used to represent a language. ...

Takes a RFC-3066 format language tag as a string and convert it to a pango:language instance that can be efficiently copied and compared with other language tags. ...

Gets the RFC-3066 format string representing the given Pango language tag. ...

Checks if a language tag matches one of the elements in a list of language ranges. ...

Determines if script is one of the scripts used to write language. ...

Determines the scripts used to to write language. ...

Returns the pango:language instance for the current locale of the process. ...

Returns the list of languages that the user prefers, as specified by the PANGO_LANGUAGE or LANGUAGE environment variables, in order of preference. ...

Get a string that is representative of the characters needed to render a particular language. ...

Given a script, finds a language tag that is reasonably representative of that script. ...


Bidirectional Text

Types and functions to help with handling bidirectional text.

Pango supports bidirectional text (like Arabic and Hebrew) automatically. Some applications however, need some help to correctly handle bidirectional text.

The pango:direction enumeration can be used with the pango:context-base-dir function to instruct Pango about direction of text, though in most cases Pango detects that correctly and automatically. The rest of the facilities in this section are used internally by Pango already, and are provided to help applications that need more direct control over bidirectional setting of text.
The pango:direction enumeration represents a direction in the Unicode bidirectional algorithm. ...

Determines the inherent direction of a character. ...

Searches a string for the first character that has a strong direction, according to the Unicode bidirectional algorithm. ...


Vertical Text

Laying text out in vertical directions.
The pango:gravity enumeration represents the orientation of glyphs in a segment of text. ...

The pango:gravity-hint enumeration defines how horizontal scripts should behave in a vertical context. ...

Finds the gravity that best matches the rotation component in a pango:matrix instance. ...

Based on the script, base gravity, and hint, returns actual gravity to use in laying out a single pango:item instance. ...

Based on the script, East Asian width, base gravity, and hint, returns actual gravity to use in laying out a single character or a pango:item instance. ...

Converts a pango:gravity value to its natural rotation in radians. ...

Rendering with Pango


Introduction to Cairo Rendering

The Cairo library is a vector graphics library with a powerful rendering model. It has such features as anti-aliased primitives, alpha-compositing, and gradients. Multiple backends for Cairo are available, to allow rendering to images, to PDF files, and to the screen on X and on other windowing systems. The functions in this section allow using Pango to render to Cairo surfaces.

Using Pango with Cairo is straightforward. A pango:context object created with the pango:font-map-create-context function can be used on any cairo:context-t instance, but needs to be updated to match the current transformation matrix and target surface of the Cairo context using the pango:cairo-update-context function. The convenience pango:cairo-create-layout and pango:cairo-update-layout functions handle the common case where the program does not need to manipulate the properties of the pango:context object.

When you get the metrics of a layout or of a piece of a layout using functions such as the pango:layout-extents function, the reported metrics are in user-space coordinates. If a piece of text is 10 units long, and you call (cairo:scale cr 2.0), it still is more-or-less 10 units long. However, the results will be affected by hinting (that is, the process of adjusting the text to look good on the pixel grid), so you should not assume they are completely independent of the current transformation matrix. Note that the basic metrics functions in Pango report results in integer Pango units. To get to the floating point units used in Cairo divide by the pango:+scale+ value.

Examples

Using Pango with Cairo
(defun draw-cairo-rendering (cr width height)
  (let ((radius (- (/ (min width height) 2) 20))
        (circle 260)
        (n-words 12)
        (font "Sans Bold 16"))
    ;; Set up a transformation matrix so that the user space
    ;; coordinates for where we are drawing are [-RADIUS, RADIUS],
    ;; [-RADIUS, RADIUS] We first center, then change the scale
    (cairo:translate cr (+ radius (/ (- width (* 2 radius)) 2))
                        (+ radius (/ (- height (* 2 radius)) 2)))
    (cairo:scale cr (/ radius circle) (/ radius circle))
    ;; Clear surface
    (cairo:set-source-rgb cr 1.0 1.0 1.0)
    (cairo:paint cr)
    ;; Create a PangoLayout, set the font and text
    (let ((layout (pango:cairo-create-layout cr))
          (desc (pango:font-description-from-string font)))
      (setf (pango:layout-text layout) "Crategus")
      (setf (pango:layout-font-description layout) desc)
      ;; Draw the layout n-words times in a circle
      (do* ((i 0 (+ i 1))
            (angle 0 (/ (* 360 i) n-words))
            ;; Gradient color
            (color (/ (+ 1 (cos (* (/ pi 180) (- angle 60)))) 2)
                   (/ (+ 1 (cos (* (/ pi 180) (- angle 60)))) 2)))
           ((>= i n-words))
           (cairo:save cr)
           (cairo:set-source-rgb cr (/ #xFF 255) (/ #x99 255) color)
           (cairo:rotate cr (/ (* angle pi) 180))
           ;; Inform Pango to re-layout the text with the new
           ;; transformation matrix
           (pango:cairo-update-layout cr layout)
           (multiple-value-bind (width height)
               (pango:layout-size layout)
             (declare (ignore height))
             (cairo:move-to cr (- (/ width 2 pango:+scale+)) (- circle)))
             (pango:cairo-show-layout cr layout)
             (cairo:restore cr)))))        

Types and functions for Cairo rendering

The pango:cairo-font interface is an interface exported by fonts for use with Cairo. ...

The pango:cairo-font-map interface is an interface exported by font maps for use with Cairo. ...

The pango:cairo-font-map-default function gets a default PangoCairo font map to use with Cairo. ...

Creates a new PangoCairo font map object. ...

Creates a new pango:font-map object of the type suitable to be used with the Cairo font backend of type fonttype. ...

Gets the type of the Cairo font backend that fontmap uses. ...

The pango:cairo-font-map-resolution function gets the resolution for the font map. ...

The pango:cairo-context-resolution function gets the resolution for the Pango context. ...

The pango:cairo-context-font-options function retrieves any font rendering options. ...

Creates a Pango context set up to match the current transformation and target surface of the Cairo context. ...

Updates a Pango context previously created for use with Cairo to match the current transformation and target surface of a Cairo context. ...

Creates a Pango layout set up to match the current transformation and target surface of the Cairo context. ...

Updates the pango:context object of a pango:layout object created with the pango:cairo-create-layout function to match the current transformation and target surface of a Cairo context. ...

Draws the glyphs in glyphs in the specified Cairo context. ...

Draws the glyphs in item in the specified Cairo context, embedding the text associated with the glyphs in the output if the output format supports it, for example PDF, otherwise it acts similar to the pango:cairo-show-glyph-string function. ...

Draws a Pango layout line in the specified Cairo context. ...

Draws a Pango layout in the specified Cairo context. ...

Draw a squiggly line in the specified Cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error. ...

Adds the glyphs in glyphs to the current path in the specified Cairo context. ...

Adds the text in the pango:layout-line instance to the current path in the specified Cairo context. ...

Adds the text in a Pango layout to the current path in the specified Cairo context. ...

Add a squiggly line to the current path in the specified Cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error. ...

Low Level Functionality


Contexts

Global context object.
The pango:context object stores global information influencing the operation of Pango, such as the font map used to look up fonts, and default values such as the default language, default gravity, or default font. ...

Creates a new Pango Context initialized to default values. ...

Forces a change in the Pango context, which will cause any pango:layout object using this Pango context to re-layout. ...

Returns the current serial number of the Pango context. ...

The pango:context-font-map function gets the pango:font-map object used to look up fonts for this context. ...

The pango:context-font-description function retrieves the default font description for the Pango context. ...

The pango:context-language function retrieves the global language tag for the Pango context. ...

The pango:context-base-dir function retrieves the base direction for the Pango context. ...

The pango:context-base-gravity function retrieves the base gravity for the Pango context. ...

Retrieves the gravity for the Pango context. ...

The pango:context-gravity-hint function retrieves the gravity hint for the Pango context. ...

The pango:contex-matrix function gets the transformation matrix that will be applied when rendering with this Pango context. ...

The pango:context-round-glyph-positions function returns whether font rendering with this Pango context should round glyph positions and widths. ...

Loads the font in one of the font maps in the Pango context that is the closest match for desc. ...

Load a set of fonts in the Pango context that can be used to render a font matching desc. ...

Get overall metric information for a particular font description. ...

List all families for a Pango context. ...


Tab Stops

Structures for storing tab stops. Functions in this section are used to deal with pango:tab-array instances that can be used to set tab stop positions in a pango:layout object.
The pango:tab-align enumeration specifies where the text appears relative to the tab stop position. ...

The pango:tab-array structure contains an array of tab stops. ...

Creates an array of size tab stops. ...

This is a convenience function that creates a pango:tab-array instance and allows you to specify the alignment and position of each tab stop. ...

Copies a tab array. ...

Gets the number of tab stops in the tab array. ...

Resizes a tab array. ...

The pango:tab-array-tab function gets the alignment and position of a tab stop. ...

Returns a list of alignment and positiongs of the tab stops in the tab array. ...

The pango:tab-array-positions-in-pixels function returns true if the tab positions are in pixels, false if they are in Pango units. ...

The pango:tab-array-decimal-point function gets the Unicode character to use as decimal point. ...

Utility function to ensure that the tab stops are in increasing order. ...

Deserializes a pango:tab-array instance from a string. ...

Serializes a pango:tab-array instance to a string. ...


Coverage Maps

Unicode character range coverage storage.
Used to indicate how well a font can represent a particular Unicode character point for a particular script. ...

The pango:coverage class represents a map from Unicode characters to pango:coverage-level values. ...

Creates a new pango:coverage object initialized to the :none value of the pango:coverage-level enumeration. ...

Determine whether a particular index is covered by coverage. ...

Modify a particular index within coverage. ...


PangoRenderer

Rendering driver base class.
The pango:render-part enumeration defines different items to render for such purposes as setting colors. ...

The pango:renderer class is a base class that contains the necessary logic for rendering pango:layout or a pango:layout-line objects. ...

Utilities


PangoRectangle and PangoMatrix

The pango:rectangle structure represents a rectangle. ...

Accessor of the x slot of the pango:rectangle structure. ...

Accessor of the y slot of the pango:rectangle structure. ...

Accessor of the width slot of the pango:rectangle structure. ...

Accessor of the height slot of the pango:rectangle structure. ...

The pango:with-rectangle macro allocates a new pango:rectangle instance, initializes the rectangle with the given values and executes the body that uses the rectangle. ...

The pango:with-rectangles macro creates new variable bindings and executes the body that use these bindings. ...

Retrieves the components of rect as integers. ...

A structure specifying a transformation between user-space coordinates and device coordinates. ...

Accessor of the xx slot of the pango:matrix structure. ...

Accessor of the xy slot of the pango:matrix structure. ...

Accessor of the yx slot of the pango:matrix structure. ...

Accessor of the yy slot of the pango:matrix structure. ...

Accessor of the x0 slot of the pango:matrix structure. ...

Accessor of the y0 slot of the pango:matrix structure. ...

Creates a new Pango matrix with the given values. ...

Returns a Pango matrix initialized to the identity transformation ...

Copies a Pango matrix. ...

Converts the matrix to a list with the components. ...

Changes the transformation represented by matrix to be the transformation given by first translating by (tx,ty) then applying the original transformation. ...

Changes the transformation represented by matrix to be the transformation given by first scaling by sx in the x direction and sy in the y direction then applying the original transformation. ...

Changes the transformation represented by matrix to be the transformation given by first rotating by degrees counter-clockwise then applying the original transformation. ...

Changes the transformation represented by matrix to be the transformation given by first applying the transformation given by other then applying the original transformation. ...

Transforms the point (x,y) by matrix. ...

Transforms the distance vector (dx,dy) by matrix. ...

First transforms rect using matrix, then calculates the bounding box of the transformed rectangle. ...

First transforms rect using matrix, then calculates the bounding box of the transformed rectangle. ...

Returns the scale factor of a matrix on the height of the font. ...

Calculates the scale factors of a matrix on the width and height of the font. ...

Gets the slant ratio of the matrix. ...


Utilities

The pango:+scale+ constant represents the scale between dimensions used for Pango distances and device units. ...

Converts a dimension to device units by rounding. ...

Extracts the ascent from a pango:rectangle instance representing glyph extents. ...

Extracts the descent from a pango:rectangle instance representing glyph extents. ...

Extracts the left bearing from a pango:rectangle instance representing glyph extents. ...

Extracts the right bearing from a pango:rectangle instance representing glyph extents. ...

Converts extents from Pango units to device units, dividing by the pango:+scale+ factor and performing rounding. ...


PangoColor

The pango:color structure is used to represent a color in an uncalibrated RGB color space. ...

Accessor of the red slot of the pango:color color. ...

Accessor of the green slot of the pango:color color. ...

Accessor of the blue slot of the pango:color color. ...

Creates a new pango:color color. ...

Creates a copy of color. ...

Fill in the fields of a color from a string specification. ...

Fill in the fields of a color from a string specification. ...

Returns a textual specification of color in the hexadecimal form #rrrrggggbbbb, where r, g and b are hex digits representing the red, green, and blue components respectively. ...


Version Information

Tools for checking Pango version at compile and run time.
Returns the encoded version of Pango available at run-time. ...

Returns the version of Pango available at run-time ...

Checks that the Pango library in use is compatible with the given version. ...



Exported Symbol Index

attr-iterator, GBoxed
attr-list, GBoxed
attribute, GBoxed
cairo-font, Interface
cairo-font-map, Interface
color, GBoxed
context, Class
coverage, Class
font, Class
font-description, GBoxed
font-face, Class
font-family, Class
font-map, Class
font-metrics, GBoxed
fontset, Class
glyph-item, GBoxed
glyph-string, GBoxed
item, GBoxed
language, GBoxed
layout, Class
layout-iter, GBoxed
layout-line, GBoxed
matrix, GBoxed
renderer, Class
tab-array, GBoxed
analysis-extra-attrs, Accessor
analysis-flags, Accessor
analysis-font, Accessor
analysis-gravity, Accessor
analysis-language, Accessor
analysis-level, Accessor
analysis-script, Accessor
ascent, Function
attr-allow-breaks-new, Function
attr-background-alpha-new, Function
attr-background-new, Function
attr-fallback-new, Function
attr-family-new, Function
attr-font-desc-new, Function
attr-font-features-new, Function
attr-foreground-alpha-new, Function
attr-foreground-new, Function
attr-gravity-hint-new, Function
attr-gravity-new, Function
attr-insert-hyphens-new, Function
attr-iterator-attrs, Function
attr-iterator-copy, Function
attr-iterator-font, Function
attr-iterator-get, Function
attr-iterator-next, Function
attr-iterator-range, Function
attr-language-new, Function
attr-letter-spacing-new, Function
attr-list-attributes, Function
attr-list-change, Function
attr-list-copy, Function
attr-list-equal, Function
attr-list-filter, Function
attr-list-from-string, Function
attr-list-insert, Function
attr-list-insert-before, Function
attr-list-iterator, Function
attr-list-new, Function
attr-list-splice, Function
attr-list-to-string, Function
attr-list-update, Function
attr-overline-color-new, Function
attr-overline-new, Function
attr-rise-new, Function
attr-scale-new, Function
attr-shape-new, Function
attr-show-new, Function
attr-size-new, Function
attr-size-new-absolute, Function
attr-stretch-new, Function
attr-strikethrough-color-new, Function
attr-strikethrough-new, Function
attr-style-new, Function
attr-type-name, Function
attr-type-register, Function
attr-underline-color-new, Function
attr-underline-new, Function
attr-variant-new, Function
attr-weight-new, Function
attribute-copy, Function
attribute-end-index, Accessor
attribute-equal, Function
attribute-start-index, Accessor
attribute-type, Accessor
cairo-context-font-options, Function
cairo-context-resolution, Function
cairo-create-context, Function
cairo-create-layout, Function
cairo-error-underline-path, Function
cairo-font-map-default, Function
cairo-font-map-font-type, Function
cairo-font-map-new, Function
cairo-font-map-new-for-font-type, Function
cairo-font-map-resolution, Function
cairo-glyph-string-path, Function
cairo-layout-line-path, Function
cairo-layout-path, Function
cairo-show-error-underline, Function
cairo-show-glyph-item, Function
cairo-show-glyph-string, Function
cairo-show-layout, Function
cairo-show-layout-line, Function
cairo-update-context, Function
cairo-update-layout, Function
color-blue, Accessor
color-copy, Function
color-green, Accessor
color-new, Function
color-parse, Function
color-parse-with-alpha, Function
color-red, Accessor
color-to-string, Function
context-base-dir, Function
context-base-gravity, Function
context-changed, Function
context-font-description, Function
context-font-map, Function
context-gravity, Function
context-gravity-hint, Function
context-language, Function
context-list-families, Function
context-load-font, Function
context-load-fontset, Function
context-matrix, Function
context-metrics, Function
context-new, Function
context-round-glyph-positions, Function
context-serial, Function
coverage-get, Function
coverage-new, Function
coverage-set, Function
descent, Function
extents-to-pixels, Function
find-base-dir, Function
font-coverage, Function
font-describe, Function
font-describe-with-absolute-size, Function
font-description-better-match, Function
font-description-copy, Function
font-description-equal, Function
font-description-family, Function
font-description-from-string, Function
font-description-gravity, Function
font-description-hash, Function
font-description-merge, Function
font-description-new, Function
font-description-set-absolute-size, Function
font-description-set-fields, Function
font-description-size, Function
font-description-size-is-absolute, Function
font-description-stretch, Function
font-description-style, Function
font-description-to-filename, Function
font-description-to-string, Function
font-description-unset-fields, Function
font-description-variant, Function
font-description-variations, Function
font-description-weight, Function
font-deserialize, Function
font-face, Function
font-face-describe, Function
font-face-face-name, Function
font-face-family, Function
font-face-is-synthesized, Function
font-face-list-sizes, Function
font-family-face, Function
font-family-is-monospace, Accessor
font-family-is-variable, Accessor
font-family-item-type, Accessor
font-family-list-faces, Function
font-family-n-items, Accessor
font-family-name, Accessor
font-font-map, Function
font-glyph-extents, Function
font-has-char, Function
font-languages, Function
font-map-changed, Function
font-map-create-context, Function
font-map-family, Function
font-map-item-type, Accessor
font-map-list-families, Function
font-map-load-font, Function
font-map-load-fontset, Function
font-map-n-items, Accessor
font-map-serial, Function
font-metrics, Function
font-metrics-approximate-char-width, Function
font-metrics-approximate-digit-width, Function
font-metrics-ascent, Function
font-metrics-descent, Function
font-metrics-height, Function
font-metrics-strikethrough-position, Function
font-metrics-strikethrough-thickness, Function
font-metrics-underline-position, Function
font-metrics-underline-thickness, Function
font-serialize, Function
fontset-font, Function
fontset-foreach, Function
fontset-metrics, Function
glyph-item-copy, Function  (undocumented)
glyph-item-split, Function  (undocumented)
glyph-string-copy, Function  (undocumented)
glyph-string-extents, Function  (undocumented)
glyph-string-extents-range, Function  (undocumented)
glyph-string-index-to-x, Function  (undocumented)
glyph-string-logical-widths, Function  (undocumented)
glyph-string-new, Function  (undocumented)
glyph-string-set-size, Function  (undocumented)
glyph-string-width, Function  (undocumented)
glyph-string-x-to-index, Function  (undocumented)
gravity-for-matrix, Function
gravity-for-script, Function
gravity-for-script-and-width, Function
gravity-to-rotation, Function
item-analysis, Accessor
item-apply-attrs, Function
item-copy, Function
item-length, Accessor
item-new, Function
item-num-chars, Accessor
item-offset, Accessor
item-split, Function
itemize, Function
itemize-with-base-dir, Function
language-default, Function
language-from-string, Function
language-includes-script, Function
language-matches, Function
language-preferred, Function
language-sample-string, Function
language-scripts, Function
language-to-string, Function
layout-alignment, Function
layout-attributes, Function
layout-auto-dir, Function
layout-baseline, Function
layout-character-count, Function
layout-context, Function
layout-context-changed, Function
layout-copy, Function
layout-cursor-pos, Function
layout-direction, Function
layout-ellipsize, Function
layout-extents, Function
layout-font-description, Function
layout-height, Function
layout-indent, Function
layout-index-to-line-x, Function
layout-index-to-pos, Function
layout-is-ellipsized, Function
layout-is-wrapped, Function
layout-iter, Function
layout-iter-at-last-line, Function
layout-iter-baseline, Function
layout-iter-char-extents, Function
layout-iter-cluster-extents, Function
layout-iter-copy, Function
layout-iter-index, Function
layout-iter-layout, Function
layout-iter-layout-extents, Function
layout-iter-line, Function
layout-iter-line-extents, Function
layout-iter-line-readonly, Function
layout-iter-line-yrange, Function
layout-iter-next-char, Function
layout-iter-next-cluster, Function
layout-iter-next-line, Function
layout-iter-next-run, Function
layout-iter-run, Function
layout-iter-run-extents, Function
layout-iter-run-readonly, Function
layout-justify, Function
layout-line, Function
layout-line-count, Function
layout-line-extents, Function
layout-line-height, Function
layout-line-index-to-x, Function
layout-line-is-paragraph-start, Function
layout-line-length, Function
layout-line-pixel-extents, Function
layout-line-readonly, Function
layout-line-resolved-direction, Function
layout-line-spacing, Function
layout-line-start-index, Function
layout-line-x-ranges, Function
layout-line-x-to-index, Function
layout-lines, Function
layout-lines-readonly, Function
layout-move-cursor-visually, Function
layout-new, Function
layout-pixel-extents, Function
layout-pixel-size, Function
layout-serial, Function
layout-set-markup, Function
layout-set-markup-with-accel, Function
layout-single-paragraph-mode, Function
layout-size, Function
layout-spacing, Function
layout-tabs, Function
layout-text, Function
layout-unknown-glyphs-count, Function
layout-width, Function
layout-wrap, Function
layout-xy-to-index, Function
lbearing, Function
matrix-concat, Function
matrix-copy, Function
matrix-font-scale-factor, Function
matrix-font-scale-factors, Function
matrix-init, Function
matrix-new, Function
matrix-rotate, Function
matrix-scale, Function
matrix-slant-ratio, Function
matrix-to-float, Function
matrix-transform-distance, Function
matrix-transform-pixel-rectangle, Function
matrix-transform-point, Function
matrix-transform-rectangle, Function
matrix-translate, Function
matrix-x0, Accessor
matrix-xx, Accessor
matrix-xy, Accessor
matrix-y0, Accessor
matrix-yx, Accessor
matrix-yy, Accessor
parse-markup, Function
pixels, Function
rbearing, Function
rectangle-height, Accessor
rectangle-to-integer, Function
rectangle-width, Accessor
rectangle-x, Accessor
rectangle-y, Accessor
script-sample-language, Function
shape, Function
shape-full, Function
shape-with-flags, Function
tab-array-copy, Function
tab-array-decimal-point, Function
tab-array-from-string, Function
tab-array-new, Function
tab-array-new-with-positions, Function
tab-array-positions-in-pixels, Function
tab-array-resize, Function
tab-array-size, Function
tab-array-sort, Function
tab-array-tab, Function
tab-array-tabs, Function
tab-array-to-string, Function
unichar-direction, Function
version, Function
version-check, Function
version-string, Function
with-rectangle, Macro
with-rectangles, Macro
alignment, GEnum
analysis, CStruct
attr-filter-func, Callback
attr-type, GEnum
baseline-shift, GEnum
coverage-level, GEnum
direction, GEnum
ellipsize-mode, GEnum
font-mask, GFlags
font-scale, GEnum
fontset-foreach-func, Callback
glyph, Type
gravity, GEnum
gravity-hint, GEnum
overline, GEnum
rectangle, CStruct
render-part, GEnum
script, GEnum
shape-flags, GFlags
show-flags, GFlags
stretch, GEnum
style, GEnum
tab-align, GEnum
text-transform, GEnum
underline, GEnum
variant, GEnum
weight, GEnum
wrap-mode, GEnum
+scale+, Constant
+scale-large+, Constant
+scale-medium+, Constant
+scale-small+, Constant
+scale-x-large+, Constant
+scale-x-small+, Constant
+scale-xx-large+, Constant
+scale-xx-small+, Constant