Functions¶
| attr_allow_breaks_new(allow_breaks) | |
| attr_background_alpha_new(alpha) | |
| attr_background_new(red, green, blue) | |
| attr_fallback_new(enable_fallback) | |
| attr_family_new(family) | |
| attr_font_desc_new(desc) | |
| attr_font_features_new(features) | |
| attr_foreground_alpha_new(alpha) | |
| attr_foreground_new(red, green, blue) | |
| attr_gravity_hint_new(hint) | |
| attr_gravity_new(gravity) | |
| attr_insert_hyphens_new(insert_hyphens) | |
| attr_language_new(language) | |
| attr_letter_spacing_new(letter_spacing) | |
| attr_overline_color_new(red, green, blue) | |
| attr_overline_new(overline) | |
| attr_rise_new(rise) | |
| attr_scale_new(scale_factor) | |
| attr_shape_new(ink_rect, logical_rect) | |
| attr_shape_new_with_data(ink_rect, logical_rect, data, copy_func) | |
| attr_show_new(flags) | |
| attr_size_new(size) | |
| attr_size_new_absolute(size) | |
| attr_stretch_new(stretch) | |
| attr_strikethrough_color_new(red, green, blue) | |
| attr_strikethrough_new(strikethrough) | |
| attr_style_new(style) | |
| attr_type_get_name(type) | |
| attr_type_register(name) | |
| attr_underline_color_new(red, green, blue) | |
| attr_underline_new(underline) | |
| attr_variant_new(variant) | |
| attr_weight_new(weight) | |
| bidi_type_for_unichar(ch) | |
| break_(text, length, analysis, attrs) | |
| default_break(text, length, analysis, attrs, attrs_len) | |
| extents_to_pixels(inclusive, nearest) | |
| find_base_dir(text, length) | |
| find_paragraph_boundary(text, length) | |
| font_description_from_string(str) | |
| get_log_attrs(text, length, level, language, log_attrs) | |
| get_mirror_char(ch, mirrored_ch) | |
| gravity_get_for_matrix(matrix) | |
| gravity_get_for_script(script, base_gravity, hint) | |
| gravity_get_for_script_and_width(script, wide, base_gravity, hint) | |
| gravity_to_rotation(gravity) | |
| is_zero_width(ch) | |
| itemize(context, text, start_index, length, attrs, cached_iter) | |
| itemize_with_base_dir(context, base_dir, text, start_index, length, attrs, cached_iter) | |
| language_from_string(language) | |
| language_get_default() | |
| log2vis_get_embedding_levels(text, length, pbase_dir) | |
| markup_parser_finish(context) | |
| markup_parser_new(accel_marker) | |
| parse_enum(type, str, warn) | |
| parse_markup(markup_text, length, accel_marker) | |
| parse_stretch(str, warn) | |
| parse_style(str, warn) | |
| parse_variant(str, warn) | |
| parse_weight(str, warn) | |
| quantize_line_geometry(thickness, position) | |
| read_line(stream, str) | |
| reorder_items(logical_items) | |
| scan_int(pos) | |
| scan_string(pos, out) | |
| scan_word(pos, out) | |
| script_for_unichar(ch) | |
| script_get_sample_language(script) | |
| shape(text, length, analysis, glyphs) | |
| shape_full(item_text, item_length, paragraph_text, paragraph_length, analysis, glyphs) | |
| shape_with_flags(item_text, item_length, paragraph_text, paragraph_length, analysis, glyphs, flags) | |
| skip_space(pos) | |
| split_file_list(str) | |
| tailor_break(text, length, analysis, offset, log_attrs) | |
| trim_string(str) | |
| unichar_direction(ch) | |
| units_from_double(d) | |
| units_to_double(i) | |
| version() | |
| version_check(required_major, required_minor, required_micro) | |
| version_string() | 
Details¶
- 
Pango.attr_allow_breaks_new(allow_breaks)[source]¶
- Parameters: - allow_breaks ( - bool) –- Trueif we line breaks are allowed- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy()- Return type: - Pango.Attribute- Create a new allow-breaks attribute. - If breaks are disabled, the range will be kept in a single run, as far as possible. - New in version 1.44. 
- 
Pango.attr_background_alpha_new(alpha)[source]¶
- Parameters: - alpha ( - int) – the alpha value, between 1 and 65536- Returns: - the new allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new background alpha attribute. - New in version 1.38. 
- 
Pango.attr_background_new(red, green, blue)[source]¶
- Parameters: - Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Create a new background color attribute. 
- 
Pango.attr_fallback_new(enable_fallback)[source]¶
- Parameters: - enable_fallback ( - bool) –- Trueif we should fall back on other fonts for characters the active font is missing.- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.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. - New in version 1.4. 
- 
Pango.attr_family_new(family)[source]¶
- Parameters: - family ( - str) – the family or comma separated list of families- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font family attribute. 
- 
Pango.attr_font_desc_new(desc)[source]¶
- Parameters: - desc ( - Pango.FontDescription) – the font description- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font description attribute. This attribute allows setting family, style, weight, variant, stretch, and size simultaneously. 
- 
Pango.attr_font_features_new(features)[source]¶
- Parameters: - features ( - str) – a string with OpenType font features, in CSS syntax- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font features tag attribute. - New in version 1.38. 
- 
Pango.attr_foreground_alpha_new(alpha)[source]¶
- Parameters: - alpha ( - int) – the alpha value, between 1 and 65536- Returns: - the new allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new foreground alpha attribute. - New in version 1.38. 
- 
Pango.attr_foreground_new(red, green, blue)[source]¶
- Parameters: - Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Create a new foreground color attribute. 
- 
Pango.attr_gravity_hint_new(hint)[source]¶
- Parameters: - hint ( - Pango.GravityHint) – the gravity hint value.- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new gravity hint attribute. - New in version 1.16. 
- 
Pango.attr_gravity_new(gravity)[source]¶
- Parameters: - gravity ( - Pango.Gravity) – the gravity value; should not be- Pango.Gravity.AUTO.- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new gravity attribute. - New in version 1.16. 
- 
Pango.attr_insert_hyphens_new(insert_hyphens)[source]¶
- Parameters: - insert_hyphens ( - bool) –- Trueif hyphens should be inserted- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy()- Return type: - Pango.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. - New in version 1.44. 
- 
Pango.attr_language_new(language)[source]¶
- Parameters: - language ( - Pango.Language) – language tag- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new language tag attribute. 
- 
Pango.attr_letter_spacing_new(letter_spacing)[source]¶
- Parameters: - letter_spacing ( - int) – amount of extra space to add between graphemes of the text, in Pango units.- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new letter-spacing attribute. - New in version 1.6. 
- 
Pango.attr_overline_color_new(red, green, blue)[source]¶
- Parameters: - Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Create a new overline color attribute. This attribute modifies the color of overlines. If not set, overlines will use the foreground color. - New in version 1.46. 
- 
Pango.attr_overline_new(overline)[source]¶
- Parameters: - overline ( - Pango.Overline) – the overline style- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new overline-style attribute. - New in version 1.46. 
- 
Pango.attr_rise_new(rise)[source]¶
- Parameters: - rise ( - int) – the amount that the text should be displaced vertically, in Pango units. Positive values displace the text upwards.- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new baseline displacement attribute. 
- 
Pango.attr_scale_new(scale_factor)[source]¶
- Parameters: - scale_factor ( - float) – factor to scale the font- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font size scale attribute. The base font for the affected text will have its size multiplied by scale_factor. 
- 
Pango.attr_shape_new(ink_rect, logical_rect)[source]¶
- Parameters: - ink_rect (Pango.Rectangle) – ink rectangle to assign to each character
- logical_rect (Pango.Rectangle) – logical rectangle to assign to each character
 - Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Create a new shape attribute. A shape is used to impose a particular ink and logical rectangle on the result of shaping a particular glyph. This might be used, for instance, for embedding a picture or a widget inside a - Pango.Layout.
- ink_rect (
- 
Pango.attr_shape_new_with_data(ink_rect, logical_rect, data, copy_func)[source]¶
- Parameters: - ink_rect (Pango.Rectangle) – ink rectangle to assign to each character
- logical_rect (Pango.Rectangle) – logical rectangle to assign to each character
- data (objectorNone) – user data pointer
- copy_func (Pango.AttrDataCopyFuncorNone) – function to copy data when the attribute is copied. IfNone, data is simply copied as a pointer.
 - Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Like - Pango.AttrShape.new(), but a user data pointer is also provided; this pointer can be accessed when later rendering the glyph.- New in version 1.8. 
- ink_rect (
- 
Pango.attr_show_new(flags)[source]¶
- Parameters: - flags ( - Pango.ShowFlags) –- Pango.ShowFlagsto apply- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new attribute that influences how invisible characters are rendered. - New in version 1.44. 
- 
Pango.attr_size_new(size)[source]¶
- Parameters: - size ( - int) – the font size, in %PANGO_SCALEths of a point.- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font-size attribute in fractional points. 
- 
Pango.attr_size_new_absolute(size)[source]¶
- Parameters: - size ( - int) – the font size, in %PANGO_SCALEths of a device unit.- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font-size attribute in device units. - New in version 1.8. 
- 
Pango.attr_stretch_new(stretch)[source]¶
- Parameters: - stretch ( - Pango.Stretch) – the stretch- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font stretch attribute 
- 
Pango.attr_strikethrough_color_new(red, green, blue)[source]¶
- Parameters: - Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Create a new strikethrough color attribute. This attribute modifies the color of strikethrough lines. If not set, strikethrough lines will use the foreground color. - New in version 1.8. 
- 
Pango.attr_strikethrough_new(strikethrough)[source]¶
- Parameters: - strikethrough ( - bool) –- Trueif the text should be struck-through.- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new strike-through attribute. 
- 
Pango.attr_style_new(style)[source]¶
- Parameters: - style ( - Pango.Style) – the slant style- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font slant style attribute. 
- 
Pango.attr_type_get_name(type)[source]¶
- Parameters: - type ( - Pango.AttrType) – an attribute type ID to fetch the name for- Returns: - the type ID name (which may be - None), or- Noneif type is a built-in Pango attribute type or invalid.- Return type: - stror- None- Fetches the attribute type name passed in when registering the type using - Pango.AttrType.register().- The returned value is an interned string (see - GLib.intern_string() for what that means) that should not be modified or freed.- New in version 1.22. 
- 
Pango.attr_type_register(name)[source]¶
- Parameters: - name ( - str) – an identifier for the type- Returns: - the new type ID. - Return type: - Pango.AttrType- Allocate a new attribute type ID. The attribute type name can be accessed later by using - Pango.AttrType.get_name().
- 
Pango.attr_underline_color_new(red, green, blue)[source]¶
- Parameters: - Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Create a new underline color attribute. This attribute modifies the color of underlines. If not set, underlines will use the foreground color. - New in version 1.8. 
- 
Pango.attr_underline_new(underline)[source]¶
- Parameters: - underline ( - Pango.Underline) – the underline style.- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new underline-style attribute. 
- 
Pango.attr_variant_new(variant)[source]¶
- Parameters: - variant ( - Pango.Variant) – the variant- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font variant attribute (normal or small caps) 
- 
Pango.attr_weight_new(weight)[source]¶
- Parameters: - weight ( - Pango.Weight) – the weight- Returns: - the newly allocated - Pango.Attribute, which should be freed with- Pango.Attribute.destroy().- Return type: - Pango.Attribute- Create a new font weight attribute. 
- 
Pango.bidi_type_for_unichar(ch)[source]¶
- Parameters: - ch ( - str) – a Unicode character- Returns: - the bidirectional character type, as used in the Unicode bidirectional algorithm. - Return type: - Pango.BidiType- Determines the normative bidirectional character type of a character, as specified in the Unicode Character Database. - A simplified version of this function is available as - Pango.unichar_direction().- New in version 1.22. 
- 
Pango.break_(text, length, analysis, attrs)[source]¶
- Parameters: - text (str) – the text to process. Must be valid UTF-8
- length (int) – length of text in bytes (may be -1 if text is nul-terminated)
- analysis (Pango.Analysis) –Pango.Analysisstructure fromPango.itemize()
- attrs ([Pango.LogAttr]) – an array to store character information in
 - 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 - Pango.get_log_attrs().- Deprecated since version 1.44: Use - Pango.default_break() and- Pango.tailor_break()
- text (
- 
Pango.default_break(text, length, analysis, attrs, attrs_len)[source]¶
- Parameters: - text (str) – text to break. Must be valid UTF-8
- length (int) – length of text in bytes (may be -1 if text is nul-terminated)
- analysis (Pango.AnalysisorNone) – aPango.Analysisfor the text
- attrs (Pango.LogAttr) – logical attributes to fill in
- attrs_len (int) – size of the array passed as attrs
 - This is the default break algorithm. It applies Unicode rules without language-specific tailoring, therefore the analyis argument is unused and can be - None.- See - Pango.tailor_break() for language-specific breaks.
- text (
- 
Pango.extents_to_pixels(inclusive, nearest)[source]¶
- Parameters: - inclusive (Pango.RectangleorNone) – rectangle to round to pixels inclusively, orNone.
- nearest (Pango.RectangleorNone) – rectangle to round to nearest pixels, orNone.
 - Converts extents from Pango units to device units, dividing by the - Pango.SCALEfactor 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. - New in version 1.16. 
- inclusive (
- 
Pango.find_base_dir(text, length)[source]¶
- Parameters: - Returns: - The direction corresponding to the first strong character. If no such character is found, then - Pango.Direction.NEUTRALis returned.- Return type: - Searches a string the first character that has a strong direction, according to the Unicode bidirectional algorithm. - New in version 1.4. 
- 
Pango.find_paragraph_boundary(text, length)[source]¶
- Parameters: - Returns: - paragraph_delimiter_index: - return location for index of delimiter - next_paragraph_start: - return location for start of next paragraph - Return type: - 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 paragraph (index after all delimiters) is stored in 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). 
- 
Pango.font_description_from_string(str)[source]¶
- Parameters: - str ( - str) – string representation of a font description.- Returns: - a new - Pango.FontDescription.- Return type: - Pango.FontDescription- Creates a new font description from a string representation in the form - “\[FAMILY-LIST] \[STYLE-OPTIONS] \[SIZE] \[VARIATIONS]”, - where FAMILY-LIST is a comma-separated list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace-separated list of words where each word describes one of style, variant, weight, stretch, or gravity, and SIZE is a decimal number (size in points) or optionally followed by the unit modifier “px” for absolute size. VARIATIONS is a comma-separated list of font variation specifications of the form “`axis`=value” (the = sign is optional). - The following words are understood as styles: “Normal”, “Roman”, “Oblique”, “Italic”. - The following words are understood as variants: “Small-Caps”. - The following words are understood as weights: “Thin”, “Ultra-Light”, “Extra-Light”, “Light”, “Semi-Light”, “Demi-Light”, “Book”, “Regular”, “Medium”, “Semi-Bold”, “Demi-Bold”, “Bold”, “Ultra-Bold”, “Extra-Bold”, “Heavy”, “Black”, “Ultra-Black”, “Extra-Black”. - The following words are understood as stretch values: “Ultra-Condensed”, “Extra-Condensed”, “Condensed”, “Semi-Condensed”, “Semi-Expanded”, “Expanded”, “Extra-Expanded”, “Ultra-Expanded”. - The following words are understood as gravity values: “Not-Rotated”, “South”, “Upside-Down”, “North”, “Rotated-Left”, “East”, “Rotated-Right”, “West”. - Any one of the options may be absent. If FAMILY-LIST is absent, then the family_name field of the resulting font description will be initialized to - None. If STYLE-OPTIONS is missing, then all style options will be set to the default values. If SIZE is missing, the size in the resulting font description will be set to 0.- A typical example: - “Cantarell Italic Light 15 `wght`=200” 
- 
Pango.get_log_attrs(text, length, level, language, log_attrs)[source]¶
- Parameters: - text (str) – text to process. Must be valid UTF-8
- length (int) – length in bytes of text
- level (int) – embedding level, or -1 if unknown
- language (Pango.Language) – language tag
- log_attrs ([Pango.LogAttr]) – array with onePango.LogAttrper character in text, plus one extra, to be filled in
 - Computes a - Pango.LogAttrfor each character in text. The log_attrs array must have one- Pango.LogAttrfor 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).
- text (
- 
Pango.get_mirror_char(ch, mirrored_ch)[source]¶
- Parameters: - Returns: - Trueif ch has a mirrored character and mirrored_ch is filled in,- Falseotherwise- Return type: - If ch has the Unicode mirrored property and there is another Unicode character that typically has a glyph that is the mirror image of ch’s glyph, puts that character in the address pointed to by mirrored_ch. - Use - GLib.unichar_get_mirror_char() instead; the docs for that function provide full details.
- 
Pango.gravity_get_for_matrix(matrix)[source]¶
- Parameters: - matrix ( - Pango.Matrixor- None) – a- Pango.Matrix- Returns: - the gravity of matrix, which will never be - Pango.Gravity.AUTO, or- Pango.Gravity.SOUTHif matrix is- None- Return type: - Pango.Gravity- Finds the gravity that best matches the rotation component in a - Pango.Matrix.- New in version 1.16. 
- 
Pango.gravity_get_for_script(script, base_gravity, hint)[source]¶
- Parameters: - script (Pango.Script) –Pango.Scriptto query
- base_gravity (Pango.Gravity) – base gravity of the paragraph
- hint (Pango.GravityHint) – orientation hint
 - Returns: - resolved gravity suitable to use for a run of text with script. - Return type: - Based on the script, base gravity, and hint, returns actual gravity to use in laying out a single - Pango.Item.- If base_gravity is - Pango.Gravity.AUTO, it is first replaced with the preferred gravity of script. To get the preferred gravity of a script, pass- Pango.Gravity.AUTOand- Pango.GravityHint.STRONGin.- New in version 1.16. 
- script (
- 
Pango.gravity_get_for_script_and_width(script, wide, base_gravity, hint)[source]¶
- Parameters: - script (Pango.Script) –Pango.Scriptto query
- wide (bool) –Truefor wide characters as returned byGLib.unichar_iswide()
- base_gravity (Pango.Gravity) – base gravity of the paragraph
- hint (Pango.GravityHint) – orientation hint
 - Returns: - resolved gravity suitable to use for a run of text with script and wide. - Return type: - Based on the script, East Asian width, base gravity, and hint, returns actual gravity to use in laying out a single character or - Pango.Item.- This function is similar to - Pango.Gravity.get_for_script() except that this function makes a distinction between narrow/half-width and wide/full-width characters also. Wide/full-width characters always stand upright, that is, they always take the base gravity, whereas narrow/full-width characters are always rotated in vertical context.- If base_gravity is - Pango.Gravity.AUTO, it is first replaced with the preferred gravity of script.- New in version 1.26. 
- script (
- 
Pango.gravity_to_rotation(gravity)[source]¶
- Parameters: - gravity ( - Pango.Gravity) – gravity to query- Returns: - the rotation value corresponding to gravity. - Return type: - float- Converts a - Pango.Gravityvalue to its natural rotation in radians. gravity should not be- Pango.Gravity.AUTO.- Note that - Pango.Matrix.rotate() takes angle in degrees, not radians. So, to call- Pango.Matrix.rotate() with the output of this function you should multiply it by (180. /- GLib.PI).- New in version 1.16. 
- 
Pango.is_zero_width(ch)[source]¶
- Parameters: - ch ( - str) – a Unicode character- Returns: - Trueif ch is a zero-width character,- Falseotherwise- Return type: - bool- Checks ch to see if it is a character that should not be normally rendered on the screen. 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.- New in version 1.10. 
- 
Pango.itemize(context, text, start_index, length, attrs, cached_iter)[source]¶
- Parameters: - context (Pango.Context) – a structure holding information that affects the itemization process.
- text (str) – the text to itemize. Must be valid UTF-8
- start_index (int) – first byte in text to process
- length (int) – the number of bytes (not characters) to process after start_index. This must be >= 0.
- attrs (Pango.AttrList) – the set of attributes that apply to text.
- cached_iter (Pango.AttrIteratororNone) – Cached attribute iterator, orNone
 - Returns: - a - GLib.Listof- Pango.Itemstructures. The items should be freed using- Pango.Item.free() probably in combination with g_list_foreach(), and the list itself using g_list_free().- Return type: - Breaks a piece of text into segments with consistent directional level and shaping engine. 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). 
- context (
- 
Pango.itemize_with_base_dir(context, base_dir, text, start_index, length, attrs, cached_iter)[source]¶
- Parameters: - context (Pango.Context) – a structure holding information that affects the itemization process.
- base_dir (Pango.Direction) – base direction to use for bidirectional processing
- text (str) – the text to itemize.
- start_index (int) – first byte in text to process
- length (int) – the number of bytes (not characters) to process after start_index. This must be >= 0.
- attrs (Pango.AttrList) – the set of attributes that apply to text.
- cached_iter (Pango.AttrIteratororNone) – Cached attribute iterator, orNone
 - Returns: - a - GLib.Listof- Pango.Itemstructures. The items should be freed using- Pango.Item.free() probably in combination with g_list_foreach(), and the list itself using g_list_free().- Return type: - Like - Pango.itemize(), but the base direction to use when computing bidirectional levels (see- Pango.Context.set_base_dir()), is specified explicitly rather than gotten from the- Pango.Context.- New in version 1.4. 
- context (
- 
Pango.language_from_string(language)[source]¶
- Parameters: - language ( - stror- None) – a string representing a language tag, or- None- Returns: - an opaque pointer to a - Pango.Languagestructure, or- Noneif language was- None. The returned pointer will be valid forever after, and should not be freed.- Return type: - Pango.Languageor- None- Take a RFC-3066 format language tag as a string and convert it to a - Pango.Languagepointer that can be efficiently copied (copy the pointer) and compared with other language tags (compare the pointer.)- This function first canonicalizes the string by converting it to lowercase, mapping ‘_’ to ‘-’, and stripping all characters other than letters and ‘-‘. - Use - Pango.Language.get_default() if you want to get the- Pango.Languagefor the current locale of the process.
- 
Pango.language_get_default()[source]¶
- Returns: - the default language as a - Pango.Language, must not be freed.- Return type: - Pango.Language- Returns the - Pango.Languagefor the current locale of the process. Note that this can change over the life of an application.- On Unix systems, this is the return value is derived from - setlocale(LC_CTYPE, NULL), and the user can affect this through the environment variables LC_ALL, LC_CTYPE or LANG (checked in that order). The locale string typically is in the form lang_COUNTRY, where lang is an ISO-639 language code, and COUNTRY is an ISO-3166 country code. For instance, sv_FI for Swedish as written in Finland or pt_BR for Portuguese as written in Brazil.- On Windows, the C library does not use any such environment variables, and setting them won’t affect the behavior of functions like ctime(). The user sets the locale through the Regional Options in the Control Panel. The C library (in the setlocale() function) does not use country and language codes, but country and language names spelled out in English. However, this function does check the above environment variables, and does return a Unix-style locale string based on either said environment variables or the thread’s current locale. - Your application should call - setlocale(LC_ALL, "");for the user settings to take effect. Gtk+ does this in its initialization functions automatically (by calling gtk_set_locale()). See- man setlocalefor more details.- New in version 1.16. 
- 
Pango.log2vis_get_embedding_levels(text, length, pbase_dir)[source]¶
- Parameters: - text (str) – the text to itemize.
- length (int) – the number of bytes (not characters) to process, or -1 if text is nul-terminated and the length should be calculated.
- pbase_dir (Pango.Direction) – input base direction, and output resolved direction.
 - Returns: - a newly allocated array of embedding levels, one item per character (not byte), that should be freed using - GLib.free.- Return type: - This will return the bidirectional embedding levels of the input paragraph as defined by the Unicode Bidirectional Algorithm available at: - http://www.unicode.org/reports/tr9/ - If the input base direction is a weak direction, the direction of the characters in the text will determine the final resolved direction. - New in version 1.4. 
- text (
- 
Pango.markup_parser_finish(context)[source]¶
- Parameters: - context ( - GLib.MarkupParseContext) – A valid parse context that was returned from- Pango.markup_parser_new()- Raises: - GLib.Error- Returns: - Falseif error is set, otherwise- True- attr_list: - address of return location for a - Pango.AttrList, or- None- text: - address of return location for text with tags stripped, or - None- accel_char: - address of return location for accelerator - str, or- None- Return type: - ( - bool, attr_list:- Pango.AttrList, text:- str, accel_char:- str)- After feeding a pango markup parser some data with - GLib.MarkupParseContext.parse(), use this function to get the list of pango attributes and text out of the markup. This function will not free context, use- GLib.MarkupParseContext.free() to do so.- New in version 1.31.0. 
- 
Pango.markup_parser_new(accel_marker)[source]¶
- Parameters: - accel_marker ( - str) – character that precedes an accelerator, or 0 for none- Returns: - a - GLib.MarkupParseContextthat should be destroyed with- GLib.MarkupParseContext.free().- Return type: - GLib.MarkupParseContext- Parses marked-up text (see - markup format) to create a plain-text string and an attribute list. - 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 - Pango.Underline.LOWattribute, and the first character so marked will be returned in accel_char, when calling 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- Pango.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 simpler - Pango.parse_markup() API is recommended instead.- New in version 1.31.0. 
- 
Pango.parse_enum(type, str, warn)[source]¶
- Parameters: - Returns: - Trueif str was successfully parsed.- value: - integer to store the result in, or - None.- possible_values: - place to store list of possible values on failure, or - None.- Return type: - 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, - Falseis 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().- New in version 1.16. - Deprecated since version 1.38. 
- 
Pango.parse_markup(markup_text, length, accel_marker)[source]¶
- Parameters: - markup_text (str) – markup to parse (see markup format)
- length (int) – length of markup_text, or -1 if nul-terminated
- accel_marker (str) – character that precedes an accelerator, or 0 for none
 - Raises: - Returns: - Falseif error is set, otherwise- True- attr_list: - address of return location for a - Pango.AttrList, or- None- text: - address of return location for text with tags stripped, or - None- accel_char: - address of return location for accelerator - str, or- None- Return type: - ( - bool, attr_list:- Pango.AttrList, text:- str, accel_char:- str)- Parses marked-up text (see - markup format) to create a plain-text string and an attribute list. - 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 - Pango.Underline.LOWattribute, 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 - Pango.markup_parser_new().- If any error happens, none of the output arguments are touched except for error. 
- markup_text (
- 
Pango.parse_stretch(str, warn)[source]¶
- Parameters: - Returns: - Trueif str was successfully parsed.- stretch: - a - Pango.Stretchto store the result in.- Return type: - ( - bool, stretch:- Pango.Stretch)- 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. 
- 
Pango.parse_style(str, warn)[source]¶
- Parameters: - Returns: - Trueif str was successfully parsed.- style: - a - Pango.Styleto store the result in.- Return type: - ( - bool, style:- Pango.Style)- Parses a font style. The allowed values are “normal”, “italic” and “oblique”, case variations being ignored. 
- 
Pango.parse_variant(str, warn)[source]¶
- Parameters: - Returns: - Trueif str was successfully parsed.- variant: - a - Pango.Variantto store the result in.- Return type: - ( - bool, variant:- Pango.Variant)- Parses a font variant. The allowed values are “normal” and “smallcaps” or “small_caps”, case variations being ignored. 
- 
Pango.parse_weight(str, warn)[source]¶
- Parameters: - Returns: - Trueif str was successfully parsed.- weight: - a - Pango.Weightto store the result in.- Return type: - ( - bool, weight:- Pango.Weight)- Parses a font weight. The allowed values are “heavy”, “ultrabold”, “bold”, “normal”, “light”, “ultraleight” and integers. Case variations are ignored. 
- 
Pango.quantize_line_geometry(thickness, position)[source]¶
- Parameters: - Returns: - thickness: - pointer to the thickness of a line, in Pango units - position: - corresponding position - Return type: - Quantizes the thickness and position of a line, typically an underline or strikethrough, to whole device pixels, that is integer multiples of - Pango.SCALE. 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. - New in version 1.12. 
- 
Pango.read_line(stream, str)[source]¶
- Parameters: - stream (objectorNone) – a stdio stream
- str (GLib.String) –GLib.Stringbuffer into which to write the result
 - Returns: - 0 if the stream was already at an %EOF character, otherwise the number of lines read (this is useful for maintaining a line number counter which doesn’t combine lines with ‘') - Return type: - 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. - Deprecated since version 1.38. 
- stream (
- 
Pango.reorder_items(logical_items)[source]¶
- Parameters: - logical_items ([ - Pango.Item]) – a- GLib.Listof- Pango.Itemin logical order.- Returns: - a - GLib.Listof- Pango.Itemstructures in visual order.- (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.) - Return type: - [ - Pango.Item]- From a list of items in logical order and the associated directional levels, produce a list in visual order. The original list is unmodified. 
- 
Pango.scan_int(pos)[source]¶
- Parameters: - pos ( - str) – in/out string position- Returns: - Falseif a parse error occurred.- pos: - in/out string position - out: - an int into which to write the result - Return type: - ( - bool, pos:- str, out:- int)- Scans an integer. Leading white space is skipped. - Deprecated since version 1.38. 
- 
Pango.scan_string(pos, out)[source]¶
- Parameters: - pos (str) – in/out string position
- out (GLib.String) – aGLib.Stringinto which to write the result
 - Returns: - Falseif a parse error occurred.- pos: - in/out string position - Return type: - Scans a string into a - GLib.Stringbuffer. 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.- Deprecated since version 1.38. 
- pos (
- 
Pango.scan_word(pos, out)[source]¶
- Parameters: - pos (str) – in/out string position
- out (GLib.String) – aGLib.Stringinto which to write the result
 - Returns: - Falseif a parse error occurred.- pos: - in/out string position - Return type: - Scans a word into a - GLib.Stringbuffer. A word consists of [A-Za-z_] followed by zero or more [A-Za-z_0-9] Leading white space is skipped.- Deprecated since version 1.38. 
- pos (
- 
Pango.script_for_unichar(ch)[source]¶
- Parameters: - ch ( - str) – a Unicode character- Returns: - the - Pango.Scriptfor the character.- Return type: - Pango.Script- Looks up the script for a particular character (as defined by Unicode Standard Annex \#24). No check is made for ch being a valid Unicode character; if you pass in invalid character, the result is undefined. - Note that while the return type of this function is declared as - Pango.Script, as of Pango 1.18, this function simply returns the return value of- GLib.unichar_get_script(). Callers must be prepared to handle unknown values.- New in version 1.4. - Deprecated since version 1.44.: Use - GLib.unichar_get_script()
- 
Pango.script_get_sample_language(script)[source]¶
- Parameters: - script ( - Pango.Script) – a- Pango.Script- Returns: - a - Pango.Languagethat is representative of the script, or- Noneif no such language exists.- Return type: - Pango.Languageor- None- Given a script, finds a language tag that is reasonably representative of that script. This will usually be the most widely spoken or used language written in that script: for instance, the sample language for - Pango.Script.CYRILLICis- ru(Russian), the sample language for- Pango.Script.ARABICis- ar.- For some scripts, no sample language will be returned because there is no language that is sufficiently representative. The best example of this is - Pango.Script.HAN, where various different variants of written Chinese, Japanese, and Korean all use significantly different sets of Han characters and forms of shared characters. No sample language can be provided for many historical scripts as well.- As of 1.18, this function checks the environment variables PANGO_LANGUAGE and LANGUAGE (checked in that order) first. If one of them is set, it is parsed as a list of language tags separated by colons or other separators. This function will return the first language in the parsed list that Pango believes may use script for writing. This last predicate is tested using - Pango.Language.includes_script(). This can be used to control Pango’s font selection for non-primary languages. For example, a PANGO_LANGUAGE enviroment variable set to “en:fa” makes Pango choose fonts suitable for Persian (fa) instead of Arabic (ar) when a segment of Arabic text is found in an otherwise non-Arabic text. The same trick can be used to choose a default language for- Pango.Script.HANwhen setting context language is not feasible.- New in version 1.4. 
- 
Pango.shape(text, length, analysis, glyphs)[source]¶
- Parameters: - text (str) – the text to process
- length (int) – the length (in bytes) of text
- analysis (Pango.Analysis) –Pango.Analysisstructure fromPango.itemize()
- glyphs (Pango.GlyphString) – glyph string in which to store results
 - Given a segment of text and the corresponding - Pango.Analysisstructure returned from- Pango.itemize(), convert the characters into glyphs. You may also pass in only a substring of the item from- Pango.itemize().- It is recommended that you use - Pango.shape_full() instead, since that API allows for shaping interaction happening across text item boundaries.
- text (
- 
Pango.shape_full(item_text, item_length, paragraph_text, paragraph_length, analysis, glyphs)[source]¶
- Parameters: - item_text (str) – valid UTF-8 text to shape.
- item_length (int) – the length (in bytes) of item_text. -1 means nul-terminated text.
- paragraph_text (strorNone) – text of the paragraph (see details). May beNone.
- paragraph_length (int) – the length (in bytes) of paragraph_text. -1 means nul-terminated text.
- analysis (Pango.Analysis) –Pango.Analysisstructure fromPango.itemize().
- glyphs (Pango.GlyphString) – glyph string in which to store results.
 - Given a segment of text and the corresponding - Pango.Analysisstructure returned from- Pango.itemize(), convert the characters into glyphs. You may also pass in only a substring of the item from- Pango.itemize().- This is similar to - Pango.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.- New in version 1.32. 
- item_text (
- 
Pango.shape_with_flags(item_text, item_length, paragraph_text, paragraph_length, analysis, glyphs, flags)[source]¶
- Parameters: - item_text (str) – valid UTF-8 text to shape
- item_length (int) – the length (in bytes) of item_text. -1 means nul-terminated text.
- paragraph_text (strorNone) – text of the paragraph (see details). May beNone.
- paragraph_length (int) – the length (in bytes) of paragraph_text. -1 means nul-terminated text.
- analysis (Pango.Analysis) –Pango.Analysisstructure fromPango.itemize()
- glyphs (Pango.GlyphString) – glyph string in which to store results
- flags (Pango.ShapeFlags) – flags influencing the shaping process
 - Given a segment of text and the corresponding - Pango.Analysisstructure returned from- Pango.itemize(), convert the characters into glyphs. You may also pass in only a substring of the item from- Pango.itemize().- This is similar to - Pango.shape_full(), except it also takes flags that can influence the shaping process.- New in version 1.44. 
- item_text (
- 
Pango.skip_space(pos)[source]¶
- Parameters: - pos ( - str) – in/out string position- Returns: - Falseif skipping the white space leaves the position at a ‘\0’ character.- pos: - in/out string position - Return type: - ( - bool, pos:- str)- Skips 0 or more characters of white space. - Deprecated since version 1.38. 
- 
Pango.split_file_list(str)[source]¶
- Parameters: - str ( - str) – a- GLib.SEARCHPATH_SEPARATORseparated list of filenames- Returns: - a list of strings to be freed with - GLib.strfreev()- Return type: - [ - str]- Splits a - GLib.SEARCHPATH_SEPARATOR-separated list of files, stripping white space and substituting ~/ with $HOME/.- Deprecated since version 1.38. 
- 
Pango.tailor_break(text, length, analysis, offset, log_attrs)[source]¶
- Parameters: - text (str) – text to process. Must be valid UTF-8
- length (int) – length in bytes of text
- analysis (Pango.Analysis) –Pango.Analysisstructure fromPango.itemize() for text
- offset (int) – Byte offset of text from the beginning of the paragraph, or -1 to ignore attributes from analysis
- log_attrs ([Pango.LogAttr]) – array with onePango.LogAttrper character in text, plus one extra, to be filled in
 - Apply language-specific tailoring to the breaks in log_attrs, which are assumed to have been produced by - Pango.default_break().- If offset is not -1, it is used to apply attributes from analysis that are relevant to line breaking. - New in version 1.44. 
- text (
- 
Pango.trim_string(str)[source]¶
- Parameters: - str ( - str) – a string- Returns: - A newly-allocated string that must be freed with - GLib.free()- Return type: - str- Trims leading and trailing whitespace from a string. - Deprecated since version 1.38. 
- 
Pango.unichar_direction(ch)[source]¶
- Parameters: - ch ( - str) – a Unicode character- Returns: - the direction of the character. - Return type: - Pango.Direction- Determines the inherent direction of a character; 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, - Pango.BidiType.for_unichar() can be used instead.
- 
Pango.units_from_double(d)[source]¶
- Parameters: - d ( - float) – double floating-point value- Returns: - the value in Pango units. - Return type: - int- Converts a floating-point number to Pango units: multiplies it by - Pango.SCALEand rounds to nearest integer.- New in version 1.16. 
- 
Pango.units_to_double(i)[source]¶
- Parameters: - i ( - int) – value in Pango units- Returns: - the double value. - Return type: - float- Converts a number in Pango units to floating-point: divides it by - Pango.SCALE.- New in version 1.16. 
- 
Pango.version()[source]¶
- Returns: - The encoded version of Pango library available at run time. - Return type: - int- This is similar to the macro %PANGO_VERSION except that it returns the encoded version of Pango available at run-time, as opposed to the version available at compile-time. - A version number can be encoded into an integer using PANGO_VERSION_ENCODE(). - New in version 1.16. 
- 
Pango.version_check(required_major, required_minor, required_micro)[source]¶
- Parameters: - Returns: - Noneif the Pango library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by Pango and should not be modified or freed.- Return type: - Checks that the Pango library in use is compatible with the given version. Generally you would pass in the constants %PANGO_VERSION_MAJOR, %PANGO_VERSION_MINOR, %PANGO_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(). - New in version 1.16. 
- 
Pango.version_string()[source]¶
- Returns: - A string containing the version of Pango library available at run time. The returned string is owned by Pango and should not be modified or freed. - Return type: - str- This is similar to the macro %PANGO_VERSION_STRING except that it returns the version of Pango available at run-time, as opposed to the version available at compile-time. - New in version 1.16.