Skip to content

Pango

API reference for the Pango namespace (version 1.0), generated from GObject-Introspection.

Classes

  • Analysis — The PangoAnalysis structure stores information about the properties of a segment of text.
  • AttrClass — The PangoAttrClass structure stores the type and operations for a particular type of attribute. The functions in this structure should…
  • AttrColor — The PangoAttrColor structure is used to represent attributes that are colors.
  • AttrFloat — The PangoAttrFloat structure is used to represent attributes with a float or double value.
  • AttrFontDesc — The PangoAttrFontDesc structure is used to store an attribute that sets all aspects of the font description at once.
  • AttrFontFeatures — The PangoAttrFontFeatures structure is used to represent OpenType font features as an attribute.
  • AttrInt — The PangoAttrInt structure is used to represent attributes with an integer or enumeration value.
  • AttrIterator — A PangoAttrIterator is used to iterate through a PangoAttrList. A new iterator is created with AttrList.get_iterator. Once the iterator…
  • AttrLanguage — The PangoAttrLanguage structure is used to represent attributes that are languages.
  • AttrList — A PangoAttrList represents a list of attributes that apply to a section of text. The attributes in a PangoAttrList are, in general,…
  • AttrShape — The PangoAttrShape structure is used to represent attributes which impose shape restrictions.
  • AttrSize — The PangoAttrSize structure is used to represent attributes which set font size.
  • AttrString — The PangoAttrString structure is used to represent attributes with a string value.
  • Attribute — The PangoAttribute structure represents the common portions of all attributes. Particular types of attributes include this structure as…
  • Color — The PangoColor structure is used to represent a color in an uncalibrated RGB color-space.
  • Context — A PangoContext stores global information used to control the itemization process. The information stored by PangoContext includes the…
  • ContextClass
  • Coverage — A PangoCoverage structure is a map from Unicode characters to CoverageLevel values. It is often necessary in Pango to determine if a…
  • Font — A PangoFont is used to represent a font in a rendering-system-independent manner.
  • FontClass
  • FontDescription — A PangoFontDescription describes a font in an implementation-independent manner. PangoFontDescription structures are used both to list…
  • FontFace — A PangoFontFace is used to represent a group of fonts with the same family, slant, weight, and width, but varying sizes.
  • FontFaceClass
  • FontFamily — A PangoFontFamily is used to represent a family of related font faces. The font faces in a family share a common design, but differ in…
  • FontFamilyClass
  • FontMap — A PangoFontMap represents the set of fonts available for a particular rendering system. This is a virtual object with implementations…
  • FontMapClass — The PangoFontMapClass structure holds the virtual functions for a particular PangoFontMap implementation.
  • FontMetrics — A PangoFontMetrics structure holds the overall metric information for a font. The information in a PangoFontMetrics structure may be…
  • Fontset — A PangoFontset represents a set of PangoFont to use when rendering text. A PangoFontset is the result of resolving a…
  • FontsetClass — The PangoFontsetClass structure holds the virtual functions for a particular PangoFontset implementation.
  • FontsetSimplePangoFontsetSimple is a implementation of the abstract PangoFontset base class as an array of fonts. When creating a…
  • FontsetSimpleClass
  • GlyphGeometry — The PangoGlyphGeometry structure contains width and positioning information for a single glyph. Note that width is not guaranteed to be…
  • GlyphInfo — A PangoGlyphInfo structure represents a single glyph with positioning information and visual attributes.
  • GlyphItem — A PangoGlyphItem is a pair of a PangoItem and the glyphs resulting from shaping the items text. As an example of the usage of…
  • GlyphItemIter — A PangoGlyphItemIter is an iterator over the clusters in a PangoGlyphItem. The forward direction of the iterator is the logical…
  • GlyphString — A PangoGlyphString is used to store strings of glyphs with geometry and visual attribute information. The storage for the glyph…
  • GlyphVisAttr — A PangoGlyphVisAttr structure communicates information between the shaping and rendering phases. Currently, it contains cluster start and…
  • Item — The PangoItem structure stores information about a segment of text. You typically obtain PangoItems by itemizing a piece of text with…
  • Language — The PangoLanguage structure is used to represent a language. PangoLanguage pointers can be efficiently copied and compared with each…
  • Layout — A PangoLayout structure represents an entire paragraph of text. While complete access to the layout capabilities of Pango is provided…
  • LayoutClass
  • LayoutIter — A PangoLayoutIter can be used to iterate over the visual extents of a PangoLayout. To obtain a PangoLayoutIter, use Layout.get_iter.…
  • LayoutLine — A PangoLayoutLine represents one of the lines resulting from laying out a paragraph via PangoLayout. PangoLayoutLine structures are…
  • LogAttr — The PangoLogAttr structure stores information about the attributes of a single character.
  • Matrix — A PangoMatrix specifies a transformation between user-space and device coordinates. The transformation is given by ``` x_device = x_user…
  • Rectangle — The PangoRectangle structure represents a rectangle. PangoRectangle is frequently used to represent the logical or ink extents of a…
  • RendererPangoRenderer is a base class for objects that can render text provided as PangoGlyphString or PangoLayout. By subclassing…
  • RendererClass — Class structure for PangoRenderer. The following vfuncs take user space coordinates in Pango units and have default implementations: -…
  • RendererPrivate
  • ScriptIter — A PangoScriptIter is used to iterate through a string and identify ranges in different scripts.
  • TabArray — A PangoTabArray contains an array of tab stops. PangoTabArray can be used to set tab stops in a PangoLayout. Each tab stop has an…

Functions

attr_allow_breaks_new

def attr_allow_breaks_new(allow_breaks: bool) -> Attribute

Create a new allow-breaks attribute.

If breaks are disabled, the range will be kept in a single run, as far as possible.

Parameters:

  • allow_breaksTrue if we line breaks are allowed

attr_background_alpha_new

def attr_background_alpha_new(alpha: int) -> Attribute

Create a new background alpha attribute.

Parameters:

  • alpha — the alpha value, between 1 and 65536

attr_background_new

def attr_background_new(red: int, green: int, blue: int) -> Attribute

Create a new background color attribute.

Parameters:

  • red — the red value (ranging from 0 to 65535)
  • green — the green value
  • blue — the blue value

attr_baseline_shift_new

def attr_baseline_shift_new(shift: int) -> Attribute

Create a new baseline displacement attribute.

The effect of this attribute is to shift the baseline of a run, relative to the run of preceding run.

<picture> <source srcset="baseline-shift-dark.png" media="(prefers-color-scheme: dark)"> <img alt="Baseline Shift" src="baseline-shift-light.png"> </picture>

Parameters:

  • shift — either a PangoBaselineShift enumeration value or an absolute value (> 1024) in Pango units, relative to the baseline of the previous run. Positive values displace the text upwards.

attr_break

def attr_break(text: str, length: int, attr_list: AttrList, offset: int) -> list[LogAttr]

Apply customization from attributes to the breaks in attrs.

The line breaks are assumed to have been produced by default_break and tailor_break.

Parameters:

  • text — text to break. Must be valid UTF-8
  • length — length of text in bytes (may be -1 if text is nul-terminated)
  • attr_listPangoAttrList to apply
  • offset — Byte offset of text from the beginning of the paragraph

attr_fallback_new

def attr_fallback_new(enable_fallback: bool) -> Attribute

Create a new font fallback attribute.

If fallback is disabled, 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.

Parameters:

  • enable_fallbackTrue if we should fall back on other fonts for characters the active font is missing

attr_family_new

def attr_family_new(family: str) -> Attribute

Create a new font family attribute.

Parameters:

  • family — the family or comma-separated list of families

attr_font_scale_new

def attr_font_scale_new(scale: FontScale | int) -> Attribute

Create a new font scale attribute.

The effect of this attribute is to change the font size of a run, relative to the size of preceding run.

Parameters:

  • scale — a PangoFontScale value, which indicates font size change relative to the size of the previous run.

attr_foreground_alpha_new

def attr_foreground_alpha_new(alpha: int) -> Attribute

Create a new foreground alpha attribute.

Parameters:

  • alpha — the alpha value, between 1 and 65536

attr_foreground_new

def attr_foreground_new(red: int, green: int, blue: int) -> Attribute

Create a new foreground color attribute.

Parameters:

  • red — the red value (ranging from 0 to 65535)
  • green — the green value
  • blue — the blue value

attr_gravity_hint_new

def attr_gravity_hint_new(hint: GravityHint | int) -> Attribute

Create a new gravity hint attribute.

Parameters:

  • hint — the gravity hint value

attr_gravity_new

def attr_gravity_new(gravity: Gravity | int) -> Attribute

Create a new gravity attribute.

Parameters:

attr_insert_hyphens_new

def attr_insert_hyphens_new(insert_hyphens: bool) -> Attribute

Create a new insert-hyphens attribute.

Pango will insert hyphens when breaking lines in the middle of a word. This attribute can be used to suppress the hyphen.

Parameters:

  • insert_hyphensTrue if hyphens should be inserted

attr_letter_spacing_new

def attr_letter_spacing_new(letter_spacing: int) -> Attribute

Create a new letter-spacing attribute.

Parameters:

  • letter_spacing — amount of extra space to add between graphemes of the text, in Pango units

attr_line_height_new

def attr_line_height_new(factor: float) -> Attribute

Modify the height of logical line extents by a factor.

This affects the values returned by LayoutLine.get_extents, LayoutLine.get_pixel_extents and LayoutIter.get_line_extents.

Parameters:

  • factor — the scaling factor to apply to the logical height

attr_line_height_new_absolute

def attr_line_height_new_absolute(height: int) -> Attribute

Override the height of logical line extents to be height.

This affects the values returned by LayoutLine.get_extents, LayoutLine.get_pixel_extents and LayoutIter.get_line_extents.

Parameters:

  • height — the line height, in SCALE-ths of a point

attr_overline_color_new

def attr_overline_color_new(red: int, green: int, blue: int) -> Attribute

Create a new overline color attribute.

This attribute modifies the color of overlines. If not set, overlines will use the foreground color.

Parameters:

  • red — the red value (ranging from 0 to 65535)
  • green — the green value
  • blue — the blue value

attr_overline_new

def attr_overline_new(overline: Overline | int) -> Attribute

Create a new overline-style attribute.

Parameters:

  • overline — the overline style

attr_rise_new

def attr_rise_new(rise: int) -> Attribute

Create a new baseline displacement attribute.

Parameters:

  • rise — the amount that the text should be displaced vertically, in Pango units. Positive values displace the text upwards.

attr_scale_new

def attr_scale_new(scale_factor: float) -> Attribute

Create a new font size scale attribute.

The base font for the affected text will have its size multiplied by scale_factor.

Parameters:

  • scale_factor — factor to scale the font

attr_sentence_new

def attr_sentence_new() -> Attribute

Marks the range of the attribute as a single sentence.

Note that this may require adjustments to word and sentence classification around the range.

attr_show_new

def attr_show_new(flags: ShowFlags | int) -> Attribute

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

Parameters:

  • flagsPangoShowFlags to apply

attr_stretch_new

def attr_stretch_new(stretch: Stretch | int) -> Attribute

Create a new font stretch attribute.

Parameters:

  • stretch — the stretch

attr_strikethrough_color_new

def attr_strikethrough_color_new(red: int, green: int, blue: int) -> Attribute

Create a new strikethrough color attribute.

This attribute modifies the color of strikethrough lines. If not set, strikethrough lines will use the foreground color.

Parameters:

  • red — the red value (ranging from 0 to 65535)
  • green — the green value
  • blue — the blue value

attr_strikethrough_new

def attr_strikethrough_new(strikethrough: bool) -> Attribute

Create a new strike-through attribute.

Parameters:

  • strikethroughTrue if the text should be struck-through

attr_style_new

def attr_style_new(style: Style | int) -> Attribute

Create a new font slant style attribute.

Parameters:

  • style — the slant style

attr_text_transform_new

def attr_text_transform_new(transform: TextTransform | int) -> Attribute

Create a new attribute that influences how characters are transformed during shaping.

Parameters:

  • transformPangoTextTransform to apply

attr_underline_color_new

def attr_underline_color_new(red: int, green: int, blue: int) -> Attribute

Create a new underline color attribute.

This attribute modifies the color of underlines. If not set, underlines will use the foreground color.

Parameters:

  • red — the red value (ranging from 0 to 65535)
  • green — the green value
  • blue — the blue value

attr_underline_new

def attr_underline_new(underline: Underline | int) -> Attribute

Create a new underline-style attribute.

Parameters:

  • underline — the underline style

attr_variant_new

def attr_variant_new(variant: Variant | int) -> Attribute

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

Parameters:

  • variant — the variant

attr_weight_new

def attr_weight_new(weight: Weight | int) -> Attribute

Create a new font weight attribute.

Parameters:

  • weight — the weight

attr_word_new

def attr_word_new() -> Attribute

Marks the range of the attribute as a single word.

Note that this may require adjustments to word and sentence classification around the range.

break_

def break_(text: str, length: int, analysis: Analysis) -> list[LogAttr]

:::warning Deprecated since 1.44 This API is deprecated. :::

Determines possible line, word, and character breaks for a string of Unicode text with a single analysis.

For most purposes you may want to use get_log_attrs.

Parameters:

  • text — the text to process. Must be valid UTF-8
  • length — length of text in bytes (may be -1 if text is nul-terminated)
  • analysisPangoAnalysis structure for text

default_break

def default_break(text: str, length: int, analysis: Analysis | None = ...) -> list[LogAttr]

This is the default break algorithm.

It applies rules from the Unicode Line Breaking Algorithm without language-specific tailoring, therefore the analyis argument is unused and can be None.

See tailor_break for language-specific breaks.

See attr_break for attribute-based customization.

Parameters:

  • text — text to break. Must be valid UTF-8
  • length — length of text in bytes (may be -1 if text is nul-terminated)
  • analysis — a PangoAnalysis structure for the text

extents_to_pixels

def extents_to_pixels(inclusive: Rectangle, nearest: Rectangle) -> tuple[Rectangle, Rectangle]

Converts extents from Pango units to device units.

The conversion is done by dividing by the SCALE factor and performing rounding.

The inclusive rectangle is converted by flooring the x/y coordinates and extending width/height, such that the final rectangle completely includes the original rectangle.

The nearest rectangle is converted by rounding the coordinates of the rectangle to the nearest device unit (pixel).

The rule to which argument to use is: if you want the resulting device-space rectangle to completely contain the original rectangle, pass it in as inclusive. If you want two touching-but-not-overlapping rectangles stay touching-but-not-overlapping after rounding to device units, pass them in as nearest.

Parameters:

  • inclusive — rectangle to round to pixels inclusively
  • nearest — rectangle to round to nearest pixels

find_base_dir

def find_base_dir(text: str, length: int) -> Direction

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

Parameters:

  • text — the text to process. Must be valid UTF-8
  • length — length of text in bytes (may be -1 if text is nul-terminated)

find_paragraph_boundary

def find_paragraph_boundary(text: str, length: int) -> tuple[int, int]

Locates a paragraph boundary in text.

A boundary is caused by delimiter characters, such as a newline, carriage return, carriage return-newline pair, or Unicode paragraph separator character.

The index of the run of delimiters is returned in paragraph_delimiter_index. The index of the start of the next paragraph (index after all delimiters) is stored n next_paragraph_start.

If no delimiters are found, both paragraph_delimiter_index and next_paragraph_start are filled with the length of text (an index one off the end).

Parameters:

  • text — UTF-8 text
  • length — length of text in bytes, or -1 if nul-terminated

get_log_attrs

def get_log_attrs(text: str, length: int, level: int, language: Language) -> list[LogAttr]

Computes a PangoLogAttr for each character in text.

The attrs array must have one PangoLogAttr for each position in text; if text contains N characters, it has N+1 positions, including the last position at the end of the text. text should be an entire paragraph; logical attributes can't be computed without context (for example you need to see spaces on either side of a word to know the word is a word).

Parameters:

  • text — text to process. Must be valid UTF-8
  • length — length in bytes of text
  • level — embedding level, or -1 if unknown
  • language — language tag

get_mirror_char

def get_mirror_char(ch: str) -> tuple[bool, str]

:::warning Deprecated since 1.30 This API is deprecated. :::

Returns the mirrored character of a Unicode character.

Mirror characters are determined by the Unicode mirrored property.

Parameters:

  • ch — a Unicode character

is_zero_width

def is_zero_width(ch: str) -> bool

Checks if a character that should not be normally rendered.

This includes all Unicode characters with "ZERO WIDTH" in their name, as well as bidi formatting characters, and a few other ones.

This is totally different from GLib.unichar_iszerowidth and is at best misnamed.

Parameters:

  • ch — a Unicode character

itemize

def itemize(context: Context, text: str, start_index: int, length: int, attrs: AttrList, cached_iter: AttrIterator | None = ...) -> list[Item]

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

Each byte of text will be contained in exactly one of the items in the returned list; the generated list of items will be in logical order (the start offsets of the items are ascending).

cached_iter should be an iterator over attrs currently positioned at a range before or containing start_index; cached_iter will be advanced to the range covering the position just after start_index + length. (i.e. if itemizing in a loop, just keep passing in the same cached_iter).

Parameters:

  • context — a structure holding information that affects the itemization process.
  • text — the text to itemize. Must be valid UTF-8
  • start_index — first byte in text to process
  • length — the number of bytes (not characters) to process after start_index. This must be >= 0.
  • attrs — the set of attributes that apply to text.
  • cached_iter — Cached attribute iterator

itemize_with_base_dir

def itemize_with_base_dir(context: Context, base_dir: Direction | int, text: str, start_index: int, length: int, attrs: AttrList, cached_iter: AttrIterator | None = ...) -> list[Item]

Like pango_itemize(), but with an explicitly specified base direction.

The base direction is used when computing bidirectional levels. itemize gets the base direction from the PangoContext (see Context.set_base_dir).

Parameters:

  • context — a structure holding information that affects the itemization process.
  • base_dir — base direction to use for bidirectional processing
  • text — the text to itemize.
  • start_index — first byte in text to process
  • length — the number of bytes (not characters) to process after start_index. This must be >= 0.
  • attrs — the set of attributes that apply to text.
  • cached_iter — Cached attribute iterator

log2vis_get_embedding_levels

def log2vis_get_embedding_levels(text: str, length: int, pbase_dir: Direction | int) -> tuple[list[int], Direction | int]

Return the bidirectional embedding levels of the input paragraph.

The bidirectional embedding levels are defined by the Unicode Bidirectional Algorithm.

If the input base direction is a weak direction, the direction of the characters in the text will determine the final resolved direction.

Parameters:

  • text — the text to itemize.
  • length — the number of bytes (not characters) to process, or -1 if text is nul-terminated and the length should be calculated.
  • pbase_dir — input base direction, and output resolved direction.

markup_parser_finish

def markup_parser_finish(context: GLib.MarkupParseContext) -> tuple[bool, AttrList, str, str]

Finishes parsing markup.

After feeding a Pango markup parser some data with GLib.MarkupParseContext.parse, use this function to get the list of attributes and text out of the markup. This function will not free context, use GLib.MarkupParseContext.free to do so.

Parameters:

  • context — A valid parse context that was returned from markup_parser_new

markup_parser_new

def markup_parser_new(accel_marker: str) -> GLib.MarkupParseContext

Incrementally parses marked-up text to create a plain-text string and an attribute list.

See the Pango Markup docs for details about the supported markup.

If accel_marker is nonzero, the given character will mark the character following it as an accelerator. For example, accel_marker might be an ampersand or underscore. All characters marked as an accelerator will receive a Underline.LOW attribute, and the first character so marked will be returned in accel_char, when calling markup_parser_finish. Two accel_marker characters following each other produce a single literal accel_marker character.

To feed markup to the parser, use GLib.MarkupParseContext.parse on the returned GLib.MarkupParseContext. When done with feeding markup to the parser, use markup_parser_finish to get the data out of it, and then use GLib.MarkupParseContext.free to free it.

This function is designed for applications that read Pango markup from streams. To simply parse a string containing Pango markup, the parse_markup API is recommended instead.

Parameters:

  • accel_marker — character that precedes an accelerator, or 0 for none

parse_enum

def parse_enum(type: type | GObject.Type, str: str | None, warn: bool) -> tuple[bool, int, str]

:::warning Deprecated since 1.38 This API is deprecated. :::

Parses an enum type and stores the result in value.

If str does not match the nick name of any of the possible values for the enum and is not an integer, False is returned, a warning is issued if warn is True, and a string representing the list of possible values is stored in possible_values. The list is slash-separated, eg. "none/start/middle/end".

If failed and possible_values is not None, returned string should be freed using GLib.free.

Parameters:

  • type — enum type to parse, eg. PANGO_TYPE_ELLIPSIZE_MODE
  • str — string to parse
  • warn — if True, issue a g_warning() on bad input

parse_markup

def parse_markup(markup_text: str, length: int, accel_marker: str) -> tuple[bool, AttrList, str, str]

Parses marked-up text to create a plain-text string and an attribute list.

See the Pango Markup docs for details about the supported markup.

If accel_marker is nonzero, the given character will mark the character following it as an accelerator. For example, accel_marker might be an ampersand or underscore. All characters marked as an accelerator will receive a Underline.LOW attribute, and the first character so marked will be returned in accel_char. Two accel_marker characters following each other produce a single literal accel_marker character.

To parse a stream of pango markup incrementally, use markup_parser_new.

If any error happens, none of the output arguments are touched except for error.

Parameters:

  • markup_text — markup to parse (see the Pango Markup docs)
  • length — length of markup_text, or -1 if nul-terminated
  • accel_marker — character that precedes an accelerator, or 0 for none

parse_stretch

def parse_stretch(str: str, warn: bool) -> tuple[bool, Stretch | int]

Parses a font stretch.

The allowed values are "ultra_condensed", "extra_condensed", "condensed", "semi_condensed", "normal", "semi_expanded", "expanded", "extra_expanded" and "ultra_expanded". Case variations are ignored and the '_' characters may be omitted.

Parameters:

  • str — a string to parse.
  • warn — if True, issue a g_warning() on bad input.

parse_style

def parse_style(str: str, warn: bool) -> tuple[bool, Style | int]

Parses a font style.

The allowed values are "normal", "italic" and "oblique", case variations being ignored.

Parameters:

  • str — a string to parse.
  • warn — if True, issue a g_warning() on bad input.

parse_variant

def parse_variant(str: str, warn: bool) -> tuple[bool, Variant | int]

Parses a font variant.

The allowed values are "normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase" and "title-caps", case variations being ignored.

Parameters:

  • str — a string to parse.
  • warn — if True, issue a g_warning() on bad input.

parse_weight

def parse_weight(str: str, warn: bool) -> tuple[bool, Weight | int]

Parses a font weight.

The allowed values are "heavy", "ultrabold", "bold", "normal", "light", "ultraleight" and integers. Case variations are ignored.

Parameters:

  • str — a string to parse.
  • warn — if True, issue a g_warning() on bad input.

quantize_line_geometry

def quantize_line_geometry(thickness: int, position: int) -> tuple[int, int]

Quantizes the thickness and position of a line to whole device pixels.

This is typically used for underline or strikethrough. The purpose of this function is to avoid such lines looking blurry.

Care is taken to make sure thickness is at least one pixel when this function returns, but returned position may become zero as a result of rounding.

Parameters:

  • thickness — pointer to the thickness of a line, in Pango units
  • position — corresponding position

read_line

def read_line(stream: int | None, str: GLib.String) -> int

:::warning Deprecated since 1.38 This API is deprecated. :::

Reads an entire line from a file into a buffer.

Lines may be delimited with '\n', '\r', '\n\r', or '\r\n'. The delimiter is not written into the buffer. Text after a '#' character is treated as a comment and skipped. '\' can be used to escape a # character. '\' proceeding a line delimiter combines adjacent lines. A '\' proceeding any other character is ignored and written into the output buffer unmodified.

Parameters:

  • stream — a stdio stream
  • strGString buffer into which to write the result

reorder_items

def reorder_items(items: list[Item]) -> list[Item]

Reorder items from logical order to visual order.

The visual order is determined from the associated directional levels of the items. The original list is unmodified.

(Please open a bug if you use this function. It is not a particularly convenient interface, and the code is duplicated elsewhere in Pango for that reason.)

Parameters:

  • items — a GList of PangoItem in logical order.

scan_int

def scan_int(pos: str) -> tuple[bool, str, int]

:::warning Deprecated since 1.38 This API is deprecated. :::

Scans an integer.

Leading white space is skipped.

Parameters:

  • pos — in/out string position

scan_string

def scan_string(pos: str, out: GLib.String) -> tuple[bool, str]

:::warning Deprecated since 1.38 This API is deprecated. :::

Scans a string into a GString buffer.

The string may either be a sequence of non-white-space characters, or a quoted string with '"'. Instead a quoted string, '\"' represents a literal quote. Leading white space outside of quotes is skipped.

Parameters:

  • pos — in/out string position
  • out — a GString into which to write the result

scan_word

def scan_word(pos: str, out: GLib.String) -> tuple[bool, str]

:::warning Deprecated since 1.38 This API is deprecated. :::

Scans a word into a GString buffer.

A word consists of [A-Za-z_] followed by zero or more [A-Za-z_0-9]. Leading white space is skipped.

Parameters:

  • pos — in/out string position
  • out — a GString into which to write the result

shape

def shape(text: str, length: int, analysis: Analysis) -> GlyphString

Convert the characters in text into glyphs.

Given a segment of text and the corresponding PangoAnalysis structure returned from itemize, convert the characters into glyphs. You may also pass in only a substring of the item from itemize.

It is recommended that you use shape_full instead, since that API allows for shaping interaction happening across text item boundaries.

Some aspects of hyphen insertion and text transformation (in particular, capitalization) require log attrs, and thus can only be handled by shape_item.

Note that the extra attributes in the analyis that is returned from itemize have indices that are relative to the entire paragraph, so you need to subtract the item offset from their indices before calling shape.

Parameters:

  • text — the text to process
  • length — the length (in bytes) of text
  • analysisPangoAnalysis structure from itemize

shape_full

def shape_full(item_text: str, item_length: int, paragraph_text: str | None, paragraph_length: int, analysis: Analysis) -> GlyphString

Convert the characters in text into glyphs.

Given a segment of text and the corresponding PangoAnalysis structure returned from itemize, convert the characters into glyphs. You may also pass in only a substring of the item from itemize.

This is similar to shape, except it also can optionally take the full paragraph text as input, which will then be used to perform certain cross-item shaping interactions. If you have access to the broader text of which item_text is part of, provide the broader text as paragraph_text. If paragraph_text is None, item text is used instead.

Some aspects of hyphen insertion and text transformation (in particular, capitalization) require log attrs, and thus can only be handled by shape_item.

Note that the extra attributes in the analyis that is returned from itemize have indices that are relative to the entire paragraph, so you do not pass the full paragraph text as paragraph_text, you need to subtract the item offset from their indices before calling shape_full.

Parameters:

  • item_text — valid UTF-8 text to shape.
  • item_length — the length (in bytes) of item_text. -1 means nul-terminated text.
  • paragraph_text — text of the paragraph (see details).
  • paragraph_length — the length (in bytes) of paragraph_text. -1 means nul-terminated text.
  • analysisPangoAnalysis structure from itemize.

shape_item

def shape_item(item: Item, paragraph_text: str | None, paragraph_length: int, log_attrs: LogAttr | None, flags: ShapeFlags | int) -> GlyphString

Convert the characters in item into glyphs.

This is similar to shape_with_flags, except it takes a PangoItem instead of separate item_text and analysis arguments.

It also takes log_attrs, which are needed for implementing some aspects of hyphen insertion and text transforms (in particular, capitalization).

Note that the extra attributes in the analyis that is returned from itemize have indices that are relative to the entire paragraph, so you do not pass the full paragraph text as paragraph_text, you need to subtract the item offset from their indices before calling shape_with_flags.

Parameters:

  • itemPangoItem to shape
  • paragraph_text — text of the paragraph (see details).
  • paragraph_length — the length (in bytes) of paragraph_text. -1 means nul-terminated text.
  • log_attrs — array of PangoLogAttr for item
  • flags — flags influencing the shaping process

shape_with_flags

def shape_with_flags(item_text: str, item_length: int, paragraph_text: str | None, paragraph_length: int, analysis: Analysis, flags: ShapeFlags | int) -> GlyphString

Convert the characters in text into glyphs.

Given a segment of text and the corresponding PangoAnalysis structure returned from itemize, convert the characters into glyphs. You may also pass in only a substring of the item from itemize.

This is similar to shape_full, except it also takes flags that can influence the shaping process.

Some aspects of hyphen insertion and text transformation (in particular, capitalization) require log attrs, and thus can only be handled by shape_item.

Note that the extra attributes in the analyis that is returned from itemize have indices that are relative to the entire paragraph, so you do not pass the full paragraph text as paragraph_text, you need to subtract the item offset from their indices before calling shape_with_flags.

Parameters:

  • item_text — valid UTF-8 text to shape
  • item_length — the length (in bytes) of item_text. -1 means nul-terminated text.
  • paragraph_text — text of the paragraph (see details).
  • paragraph_length — the length (in bytes) of paragraph_text. -1 means nul-terminated text.
  • analysisPangoAnalysis structure from itemize
  • flags — flags influencing the shaping process

skip_space

def skip_space(pos: str) -> tuple[bool, str]

:::warning Deprecated since 1.38 This API is deprecated. :::

Skips 0 or more characters of white space.

Parameters:

  • pos — in/out string position

split_file_list

def split_file_list(str: str) -> list[str]

:::warning Deprecated since 1.38 This API is deprecated. :::

Splits a GLib.SEARCHPATH_SEPARATOR-separated list of files, stripping white space and substituting ~/ with $HOME/.

Parameters:

tailor_break

def tailor_break(text: str, length: int, analysis: Analysis, offset: int) -> list[LogAttr]

Apply language-specific tailoring to the breaks in attrs.

The line breaks are assumed to have been produced by default_break.

If offset is not -1, it is used to apply attributes from analysis that are relevant to line breaking.

Note that it is better to pass -1 for offset and use attr_break to apply attributes to the whole paragraph.

Parameters:

  • text — text to process. Must be valid UTF-8
  • length — length in bytes of text
  • analysisPangoAnalysis for text
  • offset — Byte offset of text from the beginning of the paragraph, or -1 to ignore attributes from analysis

trim_string

def trim_string(str: str) -> str

:::warning Deprecated since 1.38 This API is deprecated. :::

Trims leading and trailing whitespace from a string.

Parameters:

  • str — a string

unichar_direction

def unichar_direction(ch: str) -> Direction

Determines the inherent direction of a character.

The inherent direction is either PANGO_DIRECTION_LTR, PANGO_DIRECTION_RTL, or PANGO_DIRECTION_NEUTRAL.

This function is useful to categorize characters into left-to-right letters, right-to-left letters, and everything else. If full Unicode bidirectional type of a character is needed, BidiType.for_unichar can be used instead.

Parameters:

  • ch — a Unicode character

units_from_double

def units_from_double(d: float) -> int

Converts a floating-point number to Pango units.

The conversion is done by multiplying d by SCALE and rounding the result to nearest integer.

Parameters:

  • d — double floating-point value

units_to_double

def units_to_double(i: int) -> float

Converts a number in Pango units to floating-point.

The conversion is done by dividing i by SCALE.

Parameters:

  • i — value in Pango units

version

def version() -> int

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

This is similar to the macro PANGO_VERSION except that the macro returns the encoded version available at compile-time. A version number can be encoded into an integer using PANGO_VERSION_ENCODE().

version_check

def version_check(required_major: int, required_minor: int, required_micro: int) -> str | None

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

Generally you would pass in the constants VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO as the three arguments to this function; that produces a check that the library in use at run-time is compatible with the version of Pango the application or module was compiled against.

Compatibility is defined by two things: first the version of the running library is newer than the version required_major.required_minor.required_micro. Second the running library must be binary compatible with the version required_major.required_minor.required_micro (same major version.)

For compile-time version checking use PANGO_VERSION_CHECK().

Parameters:

  • required_major — the required major version
  • required_minor — the required minor version
  • required_micro — the required major version

version_string

def version_string() -> str

Returns the version of Pango available at run-time.

This is similar to the macro VERSION_STRING except that the macro returns the version available at compile-time.

Enumerations

Alignment

Enumeration.

  • LEFT = 0 — Put all available space on the right
  • CENTER = 1 — Center the line within the available space
  • RIGHT = 2 — Put all available space on the left

AttrType

Enumeration.

  • INVALID = 0 — does not happen
  • LANGUAGE = 1 — language (AttrLanguage)
  • FAMILY = 2 — font family name list (AttrString)
  • STYLE = 3 — font slant style (AttrInt)
  • WEIGHT = 4 — font weight (AttrInt)
  • VARIANT = 5 — font variant (normal or small caps) (AttrInt)
  • STRETCH = 6 — font stretch (AttrInt)
  • SIZE = 7 — font size in points scaled by SCALE (AttrInt)
  • FONT_DESC = 8 — font description (AttrFontDesc)
  • FOREGROUND = 9 — foreground color (AttrColor)
  • BACKGROUND = 10 — background color (AttrColor)
  • UNDERLINE = 11 — whether the text has an underline (AttrInt)
  • STRIKETHROUGH = 12 — whether the text is struck-through (AttrInt)
  • RISE = 13 — baseline displacement (AttrInt)
  • SHAPE = 14 — shape (AttrShape)
  • SCALE = 15 — font size scale factor (AttrFloat)
  • FALLBACK = 16 — whether fallback is enabled (AttrInt)
  • LETTER_SPACING = 17 — letter spacing (PangoAttrInt)
  • UNDERLINE_COLOR = 18 — underline color (AttrColor)
  • STRIKETHROUGH_COLOR = 19 — strikethrough color (AttrColor)
  • ABSOLUTE_SIZE = 20 — font size in pixels scaled by SCALE (AttrInt)
  • GRAVITY = 21 — base text gravity (AttrInt)
  • GRAVITY_HINT = 22 — gravity hint (AttrInt)
  • FONT_FEATURES = 23 — OpenType font features (AttrFontFeatures). Since 1.38
  • FOREGROUND_ALPHA = 24 — foreground alpha (AttrInt). Since 1.38
  • BACKGROUND_ALPHA = 25 — background alpha (AttrInt). Since 1.38
  • ALLOW_BREAKS = 26 — whether breaks are allowed (AttrInt). Since 1.44
  • SHOW = 27 — how to render invisible characters (AttrInt). Since 1.44
  • INSERT_HYPHENS = 28 — whether to insert hyphens at intra-word line breaks (AttrInt). Since 1.44
  • OVERLINE = 29 — whether the text has an overline (AttrInt). Since 1.46
  • OVERLINE_COLOR = 30 — overline color (AttrColor). Since 1.46
  • LINE_HEIGHT = 31 — line height factor (AttrFloat). Since: 1.50
  • ABSOLUTE_LINE_HEIGHT = 32 — line height (AttrInt). Since: 1.50
  • TEXT_TRANSFORM = 33
  • WORD = 34 — override segmentation to classify the range of the attribute as a single word (AttrInt). Since 1.50
  • SENTENCE = 35 — override segmentation to classify the range of the attribute as a single sentence (AttrInt). Since 1.50
  • BASELINE_SHIFT = 36 — baseline displacement (AttrInt). Since 1.50
  • FONT_SCALE = 37 — font-relative size change (AttrInt). Since 1.50

BaselineShift

Enumeration.

  • NONE = 0 — Leave the baseline unchanged
  • SUPERSCRIPT = 1 — Shift the baseline to the superscript position, relative to the previous run
  • SUBSCRIPT = 2 — Shift the baseline to the subscript position, relative to the previous run

BidiType

Enumeration.

  • L = 0 — Left-to-Right
  • LRE = 1 — Left-to-Right Embedding
  • LRO = 2 — Left-to-Right Override
  • R = 3 — Right-to-Left
  • AL = 4 — Right-to-Left Arabic
  • RLE = 5 — Right-to-Left Embedding
  • RLO = 6 — Right-to-Left Override
  • PDF = 7 — Pop Directional Format
  • EN = 8 — European Number
  • ES = 9 — European Number Separator
  • ET = 10 — European Number Terminator
  • AN = 11 — Arabic Number
  • CS = 12 — Common Number Separator
  • NSM = 13 — Nonspacing Mark
  • BN = 14 — Boundary Neutral
  • B = 15 — Paragraph Separator
  • S = 16 — Segment Separator
  • WS = 17 — Whitespace
  • ON = 18 — Other Neutrals
  • LRI = 19 — Left-to-Right isolate. Since 1.48.6
  • RLI = 20 — Right-to-Left isolate. Since 1.48.6
  • FSI = 21 — First strong isolate. Since 1.48.6
  • PDI = 22 — Pop directional isolate. Since 1.48.6

CoverageLevel

Enumeration.

  • NONE = 0 — The character is not representable with the font.
  • FALLBACK = 1 — The character is represented in a way that may be comprehensible but is not the correct graphical form. For instance, a Hangul character represented as a a sequence of Jamos, or a Latin transliteration of a Cyrillic word.
  • APPROXIMATE = 2 — The character is represented as basically the correct graphical form, but with a stylistic variant inappropriate for the current script.
  • EXACT = 3 — The character is represented as the correct graphical form.

Direction

Enumeration.

  • LTR = 0 — A strong left-to-right direction
  • RTL = 1 — A strong right-to-left direction
  • TTB_LTR = 2 — Deprecated value; treated the same as PANGO_DIRECTION_RTL.
  • TTB_RTL = 3 — Deprecated value; treated the same as PANGO_DIRECTION_LTR
  • WEAK_LTR = 4 — A weak left-to-right direction
  • WEAK_RTL = 5 — A weak right-to-left direction
  • NEUTRAL = 6 — No direction specified

EllipsizeMode

Enumeration.

  • NONE = 0 — No ellipsization
  • START = 1 — Omit characters at the start of the text
  • MIDDLE = 2 — Omit characters in the middle of the text
  • END = 3 — Omit characters at the end of the text

FontColor

Enumeration.

  • FORBIDDEN = 0 — The font should not have color glyphs
  • REQUIRED = 1 — The font should have color glyphs
  • DONT_CARE = 2 — The font may or may not use color

FontMask

Bit flags.

  • FAMILY = 1 — the font family is specified.
  • STYLE = 2 — the font style is specified.
  • VARIANT = 4 — the font variant is specified.
  • WEIGHT = 8 — the font weight is specified.
  • STRETCH = 16 — the font stretch is specified.
  • SIZE = 32 — the font size is specified.
  • GRAVITY = 64 — The font gravity is specified.
  • VARIATIONS = 128 — OpenType font variations are specified.
  • FEATURES = 256 — OpenType font features are specified.
  • COLOR = 512 — Font color is specified.

FontScale

Enumeration.

  • NONE = 0 — Leave the font size unchanged
  • SUPERSCRIPT = 1 — Change the font to a size suitable for superscripts
  • SUBSCRIPT = 2 — Change the font to a size suitable for subscripts
  • SMALL_CAPS = 3 — Change the font to a size suitable for Small Caps

Gravity

Enumeration.

  • SOUTH = 0 — Glyphs stand upright (default) <img align="right" valign="center" src="m-south.png">
  • EAST = 1 — Glyphs are rotated 90 degrees counter-clockwise. <img align="right" valign="center" src="m-east.png">
  • NORTH = 2 — Glyphs are upside-down. <img align="right" valign="cener" src="m-north.png">
  • WEST = 3 — Glyphs are rotated 90 degrees clockwise. <img align="right" valign="center" src="m-west.png">
  • AUTO = 4 — Gravity is resolved from the context matrix

GravityHint

Enumeration.

  • NATURAL = 0 — scripts will take their natural gravity based on the base gravity and the script. This is the default.
  • STRONG = 1 — always use the base gravity set, regardless of the script.
  • LINE = 2 — for scripts not in their natural direction (eg. Latin in East gravity), choose per-script gravity such that every script respects the line progression. This means, Latin and Arabic will take opposite gravities and both flow top-to-bottom for example.

LayoutDeserializeError

Enumeration.

  • INVALID = 0 — Unspecified error
  • INVALID_VALUE = 1 — A JSon value could not be interpreted
  • MISSING_VALUE = 2 — A required JSon member was not found

LayoutDeserializeFlags

Bit flags.

  • DEFAULT = 0 — Default behavior
  • CONTEXT = 1 — Apply context information from the serialization to the PangoContext

LayoutSerializeFlags

Bit flags.

  • DEFAULT = 0 — Default behavior
  • CONTEXT = 1 — Include context information
  • OUTPUT = 2 — Include information about the formatted output

Overline

Enumeration.

  • NONE = 0 — no overline should be drawn
  • SINGLE = 1 — Draw a single line above the ink extents of the text being underlined.

RenderPart

Enumeration.

  • FOREGROUND = 0 — the text itself
  • BACKGROUND = 1 — the area behind the text
  • UNDERLINE = 2 — underlines
  • STRIKETHROUGH = 3 — strikethrough lines
  • OVERLINE = 4 — overlines

Script

Enumeration.

  • INVALID_CODE = -1 — a value never returned from Script.for_unichar
  • COMMON = 0 — a character used by multiple different scripts
  • INHERITED = 1 — a mark glyph that takes its script from the base glyph to which it is attached
  • ARABIC = 2 — Arabic
  • ARMENIAN = 3 — Armenian
  • BENGALI = 4 — Bengali
  • BOPOMOFO = 5 — Bopomofo
  • CHEROKEE = 6 — Cherokee
  • COPTIC = 7 — Coptic
  • CYRILLIC = 8 — Cyrillic
  • DESERET = 9 — Deseret
  • DEVANAGARI = 10 — Devanagari
  • ETHIOPIC = 11 — Ethiopic
  • GEORGIAN = 12 — Georgian
  • GOTHIC = 13 — Gothic
  • GREEK = 14 — Greek
  • GUJARATI = 15 — Gujarati
  • GURMUKHI = 16 — Gurmukhi
  • HAN = 17 — Han
  • HANGUL = 18 — Hangul
  • HEBREW = 19 — Hebrew
  • HIRAGANA = 20 — Hiragana
  • KANNADA = 21 — Kannada
  • KATAKANA = 22 — Katakana
  • KHMER = 23 — Khmer
  • LAO = 24 — Lao
  • LATIN = 25 — Latin
  • MALAYALAM = 26 — Malayalam
  • MONGOLIAN = 27 — Mongolian
  • MYANMAR = 28 — Myanmar
  • OGHAM = 29 — Ogham
  • OLD_ITALIC = 30 — Old Italic
  • ORIYA = 31 — Oriya
  • RUNIC = 32 — Runic
  • SINHALA = 33 — Sinhala
  • SYRIAC = 34 — Syriac
  • TAMIL = 35 — Tamil
  • TELUGU = 36 — Telugu
  • THAANA = 37 — Thaana
  • THAI = 38 — Thai
  • TIBETAN = 39 — Tibetan
  • CANADIAN_ABORIGINAL = 40 — Canadian Aboriginal
  • YI = 41 — Yi
  • TAGALOG = 42 — Tagalog
  • HANUNOO = 43 — Hanunoo
  • BUHID = 44 — Buhid
  • TAGBANWA = 45 — Tagbanwa
  • BRAILLE = 46 — Braille
  • CYPRIOT = 47 — Cypriot
  • LIMBU = 48 — Limbu
  • OSMANYA = 49 — Osmanya
  • SHAVIAN = 50 — Shavian
  • LINEAR_B = 51 — Linear B
  • TAI_LE = 52 — Tai Le
  • UGARITIC = 53 — Ugaritic
  • NEW_TAI_LUE = 54 — New Tai Lue. Since 1.10
  • BUGINESE = 55 — Buginese. Since 1.10
  • GLAGOLITIC = 56 — Glagolitic. Since 1.10
  • TIFINAGH = 57 — Tifinagh. Since 1.10
  • SYLOTI_NAGRI = 58 — Syloti Nagri. Since 1.10
  • OLD_PERSIAN = 59 — Old Persian. Since 1.10
  • KHAROSHTHI = 60 — Kharoshthi. Since 1.10
  • UNKNOWN = 61 — an unassigned code point. Since 1.14
  • BALINESE = 62 — Balinese. Since 1.14
  • CUNEIFORM = 63 — Cuneiform. Since 1.14
  • PHOENICIAN = 64 — Phoenician. Since 1.14
  • PHAGS_PA = 65 — Phags-pa. Since 1.14
  • NKO = 66 — N'Ko. Since 1.14
  • KAYAH_LI = 67 — Kayah Li. Since 1.20.1
  • LEPCHA = 68 — Lepcha. Since 1.20.1
  • REJANG = 69 — Rejang. Since 1.20.1
  • SUNDANESE = 70 — Sundanese. Since 1.20.1
  • SAURASHTRA = 71 — Saurashtra. Since 1.20.1
  • CHAM = 72 — Cham. Since 1.20.1
  • OL_CHIKI = 73 — Ol Chiki. Since 1.20.1
  • VAI = 74 — Vai. Since 1.20.1
  • CARIAN = 75 — Carian. Since 1.20.1
  • LYCIAN = 76 — Lycian. Since 1.20.1
  • LYDIAN = 77 — Lydian. Since 1.20.1
  • BATAK = 78 — Batak. Since 1.32
  • BRAHMI = 79 — Brahmi. Since 1.32
  • MANDAIC = 80 — Mandaic. Since 1.32
  • CHAKMA = 81 — Chakma. Since: 1.32
  • MEROITIC_CURSIVE = 82 — Meroitic Cursive. Since: 1.32
  • MEROITIC_HIEROGLYPHS = 83 — Meroitic Hieroglyphs. Since: 1.32
  • MIAO = 84 — Miao. Since: 1.32
  • SHARADA = 85 — Sharada. Since: 1.32
  • SORA_SOMPENG = 86 — Sora Sompeng. Since: 1.32
  • TAKRI = 87 — Takri. Since: 1.32
  • BASSA_VAH = 88 — Bassa. Since: 1.40
  • CAUCASIAN_ALBANIAN = 89 — Caucasian Albanian. Since: 1.40
  • DUPLOYAN = 90 — Duployan. Since: 1.40
  • ELBASAN = 91 — Elbasan. Since: 1.40
  • GRANTHA = 92 — Grantha. Since: 1.40
  • KHOJKI = 93 — Kjohki. Since: 1.40
  • KHUDAWADI = 94 — Khudawadi, Sindhi. Since: 1.40
  • LINEAR_A = 95 — Linear A. Since: 1.40
  • MAHAJANI = 96 — Mahajani. Since: 1.40
  • MANICHAEAN = 97 — Manichaean. Since: 1.40
  • MENDE_KIKAKUI = 98 — Mende Kikakui. Since: 1.40
  • MODI = 99 — Modi. Since: 1.40
  • MRO = 100 — Mro. Since: 1.40
  • NABATAEAN = 101 — Nabataean. Since: 1.40
  • OLD_NORTH_ARABIAN = 102 — Old North Arabian. Since: 1.40
  • OLD_PERMIC = 103 — Old Permic. Since: 1.40
  • PAHAWH_HMONG = 104 — Pahawh Hmong. Since: 1.40
  • PALMYRENE = 105 — Palmyrene. Since: 1.40
  • PAU_CIN_HAU = 106 — Pau Cin Hau. Since: 1.40
  • PSALTER_PAHLAVI = 107 — Psalter Pahlavi. Since: 1.40
  • SIDDHAM = 108 — Siddham. Since: 1.40
  • TIRHUTA = 109 — Tirhuta. Since: 1.40
  • WARANG_CITI = 110 — Warang Citi. Since: 1.40
  • AHOM = 111 — Ahom. Since: 1.40
  • ANATOLIAN_HIEROGLYPHS = 112 — Anatolian Hieroglyphs. Since: 1.40
  • HATRAN = 113 — Hatran. Since: 1.40
  • MULTANI = 114 — Multani. Since: 1.40
  • OLD_HUNGARIAN = 115 — Old Hungarian. Since: 1.40
  • SIGNWRITING = 116 — Signwriting. Since: 1.40

ShapeFlags

Bit flags.

  • NONE = 0 — Default value
  • ROUND_POSITIONS = 1 — Round glyph positions and widths to whole device units This option should be set if the target renderer can't do subpixel positioning of glyphs

ShowFlags

Bit flags.

  • NONE = 0 — No special treatment for invisible characters
  • SPACES = 1 — Render spaces, tabs and newlines visibly
  • LINE_BREAKS = 2 — Render line breaks visibly
  • IGNORABLES = 4 — Render default-ignorable Unicode characters visibly

Stretch

Enumeration.

  • ULTRA_CONDENSED = 0 — ultra condensed width
  • EXTRA_CONDENSED = 1 — extra condensed width
  • CONDENSED = 2 — condensed width
  • SEMI_CONDENSED = 3 — semi condensed width
  • NORMAL = 4 — the normal width
  • SEMI_EXPANDED = 5 — semi expanded width
  • EXPANDED = 6 — expanded width
  • EXTRA_EXPANDED = 7 — extra expanded width
  • ULTRA_EXPANDED = 8 — ultra expanded width

Style

Enumeration.

  • NORMAL = 0 — the font is upright.
  • OBLIQUE = 1 — the font is slanted, but in a roman style.
  • ITALIC = 2 — the font is slanted in an italic style.

TabAlign

Enumeration.

  • LEFT = 0 — the text appears to the right of the tab stop position
  • RIGHT = 1 — the text appears to the left of the tab stop position until the available space is filled. Since: 1.50
  • CENTER = 2 — the text is centered at the tab stop position until the available space is filled. Since: 1.50
  • DECIMAL = 3 — text before the first occurrence of the decimal point character appears to the left of the tab stop position (until the available space is filled), the rest to the right. Since: 1.50

TextTransform

Enumeration.

  • NONE = 0 — Leave text unchanged
  • LOWERCASE = 1 — Display letters and numbers as lowercase
  • UPPERCASE = 2 — Display letters and numbers as uppercase
  • CAPITALIZE = 3 — Display the first character of a word in titlecase

Underline

Enumeration.

  • NONE = 0 — no underline should be drawn
  • SINGLE = 1 — a single underline should be drawn
  • DOUBLE = 2 — a double underline should be drawn
  • LOW = 3 — a single underline should be drawn at a position beneath the ink extents of the text being underlined. This should be used only for underlining single characters, such as for keyboard accelerators. Underline.SINGLE should be used for extended portions of text.
  • ERROR = 4 — an underline indicating an error should be drawn below. The exact style of rendering is up to the PangoRenderer in use, but typical styles include wavy or dotted lines. This underline is typically used to indicate an error such as a possible mispelling; in some cases a contrasting color may automatically be used. This type of underlining is available since Pango 1.4.
  • SINGLE_LINE = 5 — Like PANGO_UNDERLINE_SINGLE, but drawn continuously across multiple runs. This type of underlining is available since Pango 1.46.
  • DOUBLE_LINE = 6 — Like PANGO_UNDERLINE_DOUBLE, but drawn continuously across multiple runs. This type of underlining is available since Pango 1.46.
  • ERROR_LINE = 7 — Like PANGO_UNDERLINE_ERROR, but drawn continuously across multiple runs. This type of underlining is available since Pango 1.46.

Variant

Enumeration.

  • NORMAL = 0 — A normal font.
  • SMALL_CAPS = 1 — A font with the lower case characters replaced by smaller variants of the capital characters.
  • ALL_SMALL_CAPS = 2 — A font with all characters replaced by smaller variants of the capital characters. Since: 1.50
  • PETITE_CAPS = 3 — A font with the lower case characters replaced by smaller variants of the capital characters. Petite Caps can be even smaller than Small Caps. Since: 1.50
  • ALL_PETITE_CAPS = 4 — A font with all characters replaced by smaller variants of the capital characters. Petite Caps can be even smaller than Small Caps. Since: 1.50
  • UNICASE = 5 — A font with the upper case characters replaced by smaller variants of the capital letters. Since: 1.50
  • TITLE_CAPS = 6 — A font with capital letters that are more suitable for all-uppercase titles. Since: 1.50

Weight

Enumeration.

  • THIN = 100 — the thin weight (= 100) Since: 1.24
  • ULTRALIGHT = 200 — the ultralight weight (= 200)
  • LIGHT = 300 — the light weight (= 300)
  • SEMILIGHT = 350 — the semilight weight (= 350) Since: 1.36.7
  • BOOK = 380 — the book weight (= 380) Since: 1.24)
  • NORMAL = 400 — the default weight (= 400)
  • MEDIUM = 500 — the medium weight (= 500) Since: 1.24
  • SEMIBOLD = 600 — the semibold weight (= 600)
  • BOLD = 700 — the bold weight (= 700)
  • ULTRABOLD = 800 — the ultrabold weight (= 800)
  • HEAVY = 900 — the heavy weight (= 900)
  • ULTRAHEAVY = 1000 — the ultraheavy weight (= 1000) Since: 1.24

WrapMode

Enumeration.

  • WORD = 0 — wrap lines at word boundaries.
  • CHAR = 1 — wrap lines at character boundaries.
  • WORD_CHAR = 2 — wrap lines at word boundaries, but fall back to character boundaries if there is not enough space for a full word.
  • NONE = 3 — do not wrap.

Constants

ANALYSIS_FLAG_CENTERED_BASELINE

ANALYSIS_FLAG_CENTERED_BASELINE: int

Whether the segment should be shifted to center around the baseline.

This is mainly used in vertical writing directions.

ANALYSIS_FLAG_IS_ELLIPSIS

ANALYSIS_FLAG_IS_ELLIPSIS: int

Whether this run holds ellipsized text.

ANALYSIS_FLAG_NEED_HYPHEN

ANALYSIS_FLAG_NEED_HYPHEN: int

Whether to add a hyphen at the end of the run during shaping.

ATTR_INDEX_FROM_TEXT_BEGINNING

ATTR_INDEX_FROM_TEXT_BEGINNING: int

Value for start_index in PangoAttribute that indicates the beginning of the text.

ATTR_INDEX_TO_TEXT_END

ATTR_INDEX_TO_TEXT_END: int

Value for end_index in PangoAttribute that indicates the end of the text.

GLYPH_EMPTY

GLYPH_EMPTY: Glyph

A PangoGlyph value that indicates a zero-width empty glpyh.

This is useful for example in shaper modules, to use as the glyph for various zero-width Unicode characters (those passing is_zero_width).

GLYPH_INVALID_INPUT

GLYPH_INVALID_INPUT: Glyph

A PangoGlyph value for invalid input.

PangoLayout produces one such glyph per invalid input UTF-8 byte and such a glyph is rendered as a crossed box.

Note that this value is defined such that it has the GLYPH_UNKNOWN_FLAG set.

GLYPH_UNKNOWN_FLAG

GLYPH_UNKNOWN_FLAG: Glyph

Flag used in PangoGlyph to turn a gunichar value of a valid Unicode character into an unknown-character glyph for that gunichar.

Such unknown-character glyphs may be rendered as a 'hex box'.

SCALE

SCALE: int

The scale between dimensions used for Pango distances and device units.

The definition of device units is dependent on the output device; it will typically be pixels for a screen, and points for a printer. SCALE is currently 1024, but this may be changed in the future.

When setting font sizes, device units are always considered to be points (as in "12 point font"), rather than pixels.

VERSION_MAJOR

VERSION_MAJOR: int

The major component of the version of Pango available at compile-time.

VERSION_MICRO

VERSION_MICRO: int

The micro component of the version of Pango available at compile-time.

VERSION_MINOR

VERSION_MINOR: int

The minor component of the version of Pango available at compile-time.

VERSION_STRING

VERSION_STRING: str

A string literal containing the version of Pango available at compile-time.

Callbacks

AttrDataCopyFunc

AttrDataCopyFunc = Callable[[], int]

AttrFilterFunc

AttrFilterFunc = Callable[[attribute: Attribute], bool]

FontsetForeachFunc

FontsetForeachFunc = Callable[[fontset: Fontset, font: Font], bool]