Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking Fn.
@pFn is the Aussom callback implementation.
@pUserData is retained and passed through to Fn on each invocation when provided.
trampoline (attribute, user_data)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
class: PangoApi
[223:14] staticextends: object
Generated low-level function wrappers for namespace Pango.
Members
lib
Methods
getLib ()
attr_allow_breaks_new (bool allow_breaks)
Create a new allow-breaks attribute. If breaks are disabled, the range will be kept in a single run, as far as possible.
@pallow_breaks is %TRUE if we line breaks are allowed.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_background_alpha_new (int alpha)
Create a new background alpha attribute.
@palpha is the alpha value, between 1 and 65536.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_background_new (int red, int green, int blue)
Create a new background color attribute.
@pred is the red value (ranging from 0 to 65535).
@pgreen is the green value.
@pblue is the blue value.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_baseline_shift_new (int shift)
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.
@pshift is 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..
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_break (string text, int length, object attr_list, int offset, int attrs_len)
Apply customization from attributes to the breaks in @attrs. The line breaks are assumed to have been produced by [func@Pango.default_break] and [func@Pango.tailor_break].
@ptext is text to break. Must be valid UTF-8.
@plength is length of text in bytes (may be -1 if @text is nul-terminated).
@pattr_list is PangoAttrList to apply.
@poffset is Byte offset of @text from the beginning of the paragraph.
@pattrs is array with one PangoLogAttr per character in @text, plus one extra, to be filled in.
@pattrs_len is length of @attrs array.
@rNone.
attr_fallback_new (bool enable_fallback)
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.
@penable_fallback is %TRUE if we should fall back on other fonts for characters the active font is missing.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_family_new (string family)
Create a new font family attribute.
@pfamily is the family or comma-separated list of families.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_font_desc_new (object desc)
Create a new font description attribute. This attribute allows setting family, style, weight, variant, stretch, and size simultaneously.
@pdesc is the font description.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_font_features_new (string features)
Create a new font features tag attribute. You can use this attribute to select OpenType font features like small-caps, alternative glyphs, ligatures, etc. for fonts that support them.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_font_scale_new (string scale)
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.
@pscale is a PangoFontScale value, which indicates font size change relative to the size of the previous run..
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_foreground_alpha_new (int alpha)
Create a new foreground alpha attribute.
@palpha is the alpha value, between 1 and 65536.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_foreground_new (int red, int green, int blue)
Create a new foreground color attribute.
@pred is the red value (ranging from 0 to 65535).
@pgreen is the green value.
@pblue is the blue value.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_gravity_hint_new (string hint)
Create a new gravity hint attribute.
@phint is the gravity hint value.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_gravity_new (string gravity)
Create a new gravity attribute.
@pgravity is the gravity value; should not be %PANGO_GRAVITY_AUTO.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_insert_hyphens_new (bool insert_hyphens)
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.
@pinsert_hyphens is %TRUE if hyphens should be inserted.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_language_new (object language)
Create a new language tag attribute.
@planguage is language tag.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_letter_spacing_new (int letter_spacing)
Create a new letter-spacing attribute.
@pletter_spacing is amount of extra space to add between graphemes of the text, in Pango units.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_line_height_new (double factor)
Modify the height of logical line extents by a factor. This affects the values returned by [method@Pango.LayoutLine.get_extents], [method@Pango.LayoutLine.get_pixel_extents] and [method@Pango.LayoutIter.get_line_extents].
@pfactor is the scaling factor to apply to the logical height.
attr_line_height_new_absolute (int height)
Override the height of logical line extents to be @height. This affects the values returned by [method@Pango.LayoutLine.get_extents], [method@Pango.LayoutLine.get_pixel_extents] and [method@Pango.LayoutIter.get_line_extents].
@pheight is the line height, in %PANGO_SCALE-ths of a point.
attr_list_from_string (string text)
Deserializes a PangoAttrList from a string. This is the counterpart to [method@Pango.AttrList.to_string]. See that functions for details about the format.
@ptext is a string.
@ra new PangoAttrList.
attr_overline_color_new (int red, int green, int blue)
Create a new overline color attribute. This attribute modifies the color of overlines. If not set, overlines will use the foreground color.
@pred is the red value (ranging from 0 to 65535).
@pgreen is the green value.
@pblue is the blue value.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_overline_new (string overline)
Create a new overline-style attribute.
@poverline is the overline style.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_rise_new (int rise)
Create a new baseline displacement attribute.
@prise is the amount that the text should be displaced vertically, in Pango units. Positive values displace the text upwards..
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_scale_new (double scale_factor)
Create a new font size scale attribute. The base font for the affected text will have its size multiplied by @scale_factor.
@pscale_factor is factor to scale the font.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_sentence_new ()
Marks the range of the attribute as a single sentence. Note that this may require adjustments to word and sentence classification around the range.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_shape_new (ink_rect, logical_rect)
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 PangoLayout.
@pink_rect is ink rectangle to assign to each character.
@plogical_rect is logical rectangle to assign to each character.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
Creates a new shape attribute. Like [func@Pango.AttrShape.new], but a user data pointer is also provided; this pointer can be accessed when later rendering the glyph.
@pink_rect is ink rectangle to assign to each character.
@plogical_rect is logical rectangle to assign to each character.
@pdata is user data pointer.
@pcopy_func is function to copy @data when the attribute is copied. If %NULL, @data is simply copied as a pointer.
@pdestroy_func is function to free @data when the attribute is freed.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_show_new (string flags)
Create a new attribute that influences how invisible characters are rendered.
@pflags is PangoShowFlags to apply.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_size_new (int size)
Create a new font-size attribute in fractional points.
@psize is the font size, in %PANGO_SCALE-ths of a point.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_size_new_absolute (int size)
Create a new font-size attribute in device units.
@psize is the font size, in %PANGO_SCALE-ths of a device unit.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_stretch_new (string stretch)
Create a new font stretch attribute.
@pstretch is the stretch.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_strikethrough_color_new (int red, int green, int blue)
Create a new strikethrough color attribute. This attribute modifies the color of strikethrough lines. If not set, strikethrough lines will use the foreground color.
@pred is the red value (ranging from 0 to 65535).
@pgreen is the green value.
@pblue is the blue value.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_strikethrough_new (bool strikethrough)
Create a new strike-through attribute.
@pstrikethrough is %TRUE if the text should be struck-through.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_style_new (string style)
Create a new font slant style attribute.
@pstyle is the slant style.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_text_transform_new (string transform)
Create a new attribute that influences how characters are transformed during shaping.
@ptransform is PangoTextTransform to apply.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_type_get_name (string type)
Fetches the attribute type name. The attribute type name is the string passed in when registering the type using [func@Pango.AttrType.register]. The returned value is an interned string (see g_intern_string() for what that means) that should not be modified or freed.
@ptype is an attribute type ID to fetch the name for.
@rthe type ID name (which may be %NULL), or %NULL if @type is a built-in Pango attribute type or invalid..
attr_type_register (string name)
Allocate a new attribute type ID. The attribute type name can be accessed later by using [func@Pango.AttrType.get_name].
@pname is an identifier for the type.
@rthe new type ID..
attr_underline_color_new (int red, int green, int blue)
Create a new underline color attribute. This attribute modifies the color of underlines. If not set, underlines will use the foreground color.
@pred is the red value (ranging from 0 to 65535).
@pgreen is the green value.
@pblue is the blue value.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_underline_new (string underline)
Create a new underline-style attribute.
@punderline is the underline style.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_variant_new (string variant)
Create a new font variant attribute (normal or small caps).
@pvariant is the variant.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy]..
attr_weight_new (string weight)
Create a new font weight attribute.
@pweight is the weight.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
attr_word_new ()
Marks the range of the attribute as a single word. Note that this may require adjustments to word and sentence classification around the range.
@rthe newly allocated PangoAttribute, which should be freed with [method@Pango.Attribute.destroy].
bidi_type_for_unichar (int ch)
Determines the bidirectional type of a character. The bidirectional type is specified in the Unicode Character Database. A simplified version of this function is available as [func@unichar_direction].
@pch is a Unicode character.
@rthe bidirectional character type, as used in the Unicode bidirectional algorithm..
FnBreak (string text, int length, object analysis, int attrs_len)
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 [func@Pango.get_log_attrs].
@ptext is the text to process. Must be valid UTF-8.
@plength is length of @text in bytes (may be -1 if @text is nul-terminated).
@panalysis is PangoAnalysis structure for @text.
@pattrs is an array to store character information in.
@pattrs_len is size of the array passed as @attrs.
@rNone.
default_break (string text, int length, object analysis, int attrs_len)
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 %NULL. See [func@Pango.tailor_break] for language-specific breaks. See [func@Pango.attr_break] for attribute-based customization.
@ptext is text to break. Must be valid UTF-8.
@plength is length of text in bytes (may be -1 if @text is nul-terminated).
@panalysis is a PangoAnalysis structure for the @text.
@pattrs is logical attributes to fill in.
@pattrs_len is size of the array passed as @attrs.
@rNone.
extents_to_pixels ()
Converts extents from Pango units to device units. The conversion is done by dividing by the %PANGO_SCALE factor and performing rounding. The
@inclusiverectangle 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.
@pinclusive is rectangle to round to pixels inclusively.
@pnearest is rectangle to round to nearest pixels.
@rNone.
find_base_dir (string text, int length)
Searches a string the first character that has a strong direction, according to the Unicode bidirectional algorithm.
@ptext is the text to process. Must be valid UTF-8.
@plength is length of @text in bytes (may be -1 if @text is nul-terminated).
@rThe direction corresponding to the first strong character. If no such character is found, then %PANGO_DIRECTION_NEUTRAL is returned..
find_paragraph_boundary (string text, int length)
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_indexand @next_paragraph_start are filled with the length of @text (an index one off the end).
@ptext is UTF-8 text.
@plength is length of @text in bytes, or -1 if nul-terminated.
@pparagraph_delimiter_index is return location for index of delimiter.
@pnext_paragraph_start is return location for start of next paragraph.
@rNone.
font_description_from_string (string str)
Creates a new font description from a string representation. The string must have the form [FAMILY-LIST] [STYLE-OPTIONS] [SIZE] [VARIATIONS] [FEATURES] 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. The following words are understood as styles: "Normal", "Roman", "Oblique", "Italic". The following words are understood as variants: "Small-Caps", "All-Small-Caps", "Petite-Caps", "All-Petite-Caps", "Unicase", "Title-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". The following words are understood as color values: "With-Color", "Without-Color". VARIATIONS is a comma-separated list of font variations of the form @axis1=value,axis2=value,... FEATURES is a comma-separated list of font features of the form #feature1=value,feature2=value,... The =value part can be ommitted if the value is 1. 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 %NULL. 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 #tnum=1
@pstr is string representation of a font description..
@ra new PangoFontDescription..
get_log_attrs (string text, int length, int level, object language, int attrs_len)
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).
@ptext is text to process. Must be valid UTF-8.
@plength is length in bytes of @text.
@plevel is embedding level, or -1 if unknown.
@planguage is language tag.
@pattrs is array with one PangoLogAttr per character in @text, plus one extra, to be filled in.
@pattrs_len is length of @attrs array.
@rNone.
get_mirror_char (int ch)
Returns the mirrored character of a Unicode character. Mirror characters are determined by the Unicode mirrored property.
@pch is a Unicode character.
@pmirrored_ch is location to store the mirrored character.
@r%TRUE if @ch has a mirrored character and @mirrored_ch is filled in, %FALSE otherwise.
gravity_get_for_matrix (object matrix)
Finds the gravity that best matches the rotation component in a PangoMatrix.
@pmatrix is a PangoMatrix.
@rthe gravity of @matrix, which will never be %PANGO_GRAVITY_AUTO, or %PANGO_GRAVITY_SOUTH if @matrix is %NULL.
Returns the gravity to use in laying out a PangoItem. The gravity is determined based on the script, base gravity, and hint. 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_AUTO and %PANGO_GRAVITY_HINT_STRONG in.
@pscript is PangoScript to query.
@pbase_gravity is base gravity of the paragraph.
@phint is orientation hint.
@rresolved gravity suitable to use for a run of text with @script.
Returns the gravity to use in laying out a single character or PangoItem. The gravity is determined based on the script, East Asian width, base gravity, and hint, This function is similar to [func@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. ``
@pscript is PangoScript to query.
@pwide is %TRUE for wide characters as returned by g_unichar_iswide().
@pbase_gravity is base gravity of the paragraph.
@phint is orientation hint.
@rresolved gravity suitable to use for a run of text with @script and
@wide.. ``
gravity_to_rotation (string gravity)
Converts a PangoGravity value to its natural rotation in radians. Note that [method@Pango.Matrix.rotate] takes angle in degrees, not radians. So, to call [method@Pango.Matrix,rotate] with the output of this function you should multiply it by (180. / G_PI).
@pgravity is gravity to query, should not be %PANGO_GRAVITY_AUTO.
@rthe rotation value corresponding to @gravity..
is_zero_width (int ch)
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 [func@GLib.unichar_iszerowidth] and is at best misnamed.
@pch is a Unicode character.
@r%TRUE if @ch is a zero-width character, %FALSE otherwise.
itemize (object context, string text, int start_index, int length, object attrs, object cached_iter)
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_itershould 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).
@pcontext is a structure holding information that affects the itemization process..
@ptext is the text to itemize. Must be valid UTF-8.
@pstart_index is first byte in @text to process.
@plength is the number of bytes (not characters) to process after
@start_index.This must be >= 0..
@pattrs is the set of attributes that apply to @text..
@pcached_iter is Cached attribute iterator.
@raGList of [struct@Pango.Item] structures. The items should be freed using [method@Pango.Item.free] in combination with [func@GLib.List.free_full]..
itemize_with_base_dir (object context, string base_dir, string text, int start_index, int length, object attrs, object cached_iter)
Like pango_itemize(), but with an explicitly specified base direction. The base direction is used when computing bidirectional levels. [func@itemize] gets the base direction from the PangoContext (see [method@Pango.Context.set_base_dir]).
@pcontext is a structure holding information that affects the itemization process..
@pbase_dir is base direction to use for bidirectional processing.
@ptext is the text to itemize..
@pstart_index is first byte in @text to process.
@plength is the number of bytes (not characters) to process after
@start_index.This must be >= 0..
@pattrs is the set of attributes that apply to @text..
@pcached_iter is Cached attribute iterator.
@raGList of [struct@Pango.Item] structures. The items should be freed using [method@Pango.Item.free] probably in combination with [func@GLib.List.free_full]..
language_from_string (string language)
Convert a language tag to a PangoLanguage. The language tag must be in a RFC-3066 format. PangoLanguage pointers 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 [func@Pango.Language.get_default] if you want to get the PangoLanguage for the current locale of the process.
@planguage is a string representing a language tag.
@raPangoLanguage.
language_get_default ()
Returns the PangoLanguage for the current locale of the process. 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 the setlocale() manpage for more details. Note that the default language can change over the life of an application. Also note that this function will not do the right thing if you use per-thread locales with uselocale(). In that case, you should just call pango_language_from_string() yourself.
@rthe default language as a PangoLanguage.
language_get_preferred ()
Returns the list of languages that the user prefers. The list is specified by the PANGO_LANGUAGE or LANGUAGE environment variables, in order of preference. Note that this list does not necessarily include the language returned by [func@Pango.Language.get_default]. When choosing language-specific resources, such as the sample text returned by [method@Pango.Language.get_sample_string], you should first try the default language, followed by the languages returned by this function.
@ra %NULL-terminated array of PangoLanguage*.
log2vis_get_embedding_levels (string text, int length, string pbase_dir)
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.
@ptext is the text to itemize..
@plength is the number of bytes (not characters) to process, or -1 if
@textis nul-terminated and the length should be calculated..
@ppbase_dir is input base direction, and output resolved direction..
@ra newly allocated array of embedding levels, one item per character (not byte), that should be freed using [func@GLib.free]..
markup_parser_finish (object context)
Finishes parsing markup. After feeding a Pango markup parser some data with [method@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 [method@GLib.MarkupParseContext.free] to do so.
@pcontext is A valid parse context that was returned from [func@markup_parser_new].
@pattr_list is address of return location for a PangoAttrList.
@ptext is address of return location for text with tags stripped.
@paccel_char is address of return location for accelerator char.
@r%FALSE if @error is set, otherwise %TRUE.
markup_parser_new (int accel_marker)
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 %PANGO_UNDERLINE_LOW attribute, and the first character so marked will be returned in
@accel_char,when calling [func@markup_parser_finish]. Two @accel_marker characters following each other produce a single literal @accel_marker character. To feed markup to the parser, use [method@GLib.MarkupParseContext.parse] on the returned [struct@GLib.MarkupParseContext]. When done with feeding markup to the parser, use [func@markup_parser_finish] to get the data out of it, and then use [method@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 [func@Pango.parse_markup] API is recommended instead.
@paccel_marker is character that precedes an accelerator, or 0 for none.
@raGMarkupParseContext that should be destroyed with [method@GLib.MarkupParseContext.free]..
parse_enum (int type, string str, bool warn)
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 %NULL, returned string should be freed using g_free().
@ptype is enum type to parse, eg. %PANGO_TYPE_ELLIPSIZE_MODE.
@pstr is string to parse.
@pvalue is integer to store the result in.
@pwarn is if %TRUE, issue a g_warning() on bad input.
@ppossible_values is place to store list of possible values on failure.
@r%TRUE if @str was successfully parsed.
parse_markup (string markup_text, int length, int accel_marker)
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_markermight be an ampersand or underscore. All characters marked as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute, and the first character so marked will be returned in @accel_char. Two
@accel_markercharacters following each other produce a single literal
@accel_markercharacter. To parse a stream of pango markup incrementally, use [func@markup_parser_new]. If any error happens, none of the output arguments are touched except for @error.
@pmarkup_text is markup to parse (see the Pango Markup docs).
@plength is length of @markup_text, or -1 if nul-terminated.
@paccel_marker is character that precedes an accelerator, or 0 for none.
@pattr_list is address of return location for a PangoAttrList.
@ptext is address of return location for text with tags stripped.
@paccel_char is address of return location for accelerator char.
@r%FALSE if @error is set, otherwise %TRUE.
parse_stretch (string str, bool warn)
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.
@pstr is a string to parse..
@pstretch is a PangoStretch to store the result in..
@pwarn is if %TRUE, issue a g_warning() on bad input..
@r%TRUE if @str was successfully parsed..
parse_style (string str, bool warn)
Parses a font style. The allowed values are "normal", "italic" and "oblique", case variations being ignored.
@pstr is a string to parse..
@pstyle is a PangoStyle to store the result in..
@pwarn is if %TRUE, issue a g_warning() on bad input..
@r%TRUE if @str was successfully parsed..
parse_variant (string str, bool warn)
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.
@pstr is a string to parse..
@pvariant is a PangoVariant to store the result in..
@pwarn is if %TRUE, issue a g_warning() on bad input..
@r%TRUE if @str was successfully parsed..
parse_weight (string str, bool warn)
Parses a font weight. The allowed values are "heavy", "ultrabold", "bold", "normal", "light", "ultraleight" and integers. Case variations are ignored.
@pstr is a string to parse..
@pweight is a PangoWeight to store the result in..
@pwarn is if %TRUE, issue a g_warning() on bad input..
@r%TRUE if @str was successfully parsed..
quantize_line_geometry (int thickness, int position)
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.
@pthickness is pointer to the thickness of a line, in Pango units.
@pposition is corresponding position.
@rNone.
read_line (stream, object str)
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.
@pstream is a stdio stream.
@pstr is GString buffer into which to write the result.
@r0 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 '').
reorder_items (list items)
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.)
@pitems is a GList of PangoItem in logical order..
@raGList of PangoItem structures in visual order..
scan_int ()
Scans an integer. Leading white space is skipped.
@ppos is in/out string position.
@pout is an int into which to write the result.
@r%FALSE if a parse error occurred.
scan_string (object out)
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.
@ppos is in/out string position.
@pout is a GString into which to write the result.
@r%FALSE if a parse error occurred.
scan_word (object out)
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.
@ppos is in/out string position.
@pout is a GString into which to write the result.
@r%FALSE if a parse error occurred.
script_for_unichar (int ch)
Looks up the script for a particular character. The script of a character is defined by Unicode Standard Annex 24: Script names. 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 PangoScript, as of Pango 1.18, this function simply returns the return value of [func@GLib.unichar_get_script]. Callers must be prepared to handle unknown values.
@pch is a Unicode character.
@rthePangoScript for the character..
script_get_sample_language (string script)
Finds a language tag that is reasonably representative of @script. The language will usually be the most widely spoken or used language written in that script: for instance, the sample language for %PANGO_SCRIPT_CYRILLIC is ru (Russian), the sample language for %PANGO_SCRIPT_ARABIC is 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 [method@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_HAN when setting context language is not feasible.
@pscript is a PangoScript.
@raPangoLanguage that is representative of the script.
skip_space ()
Skips 0 or more characters of white space.
@ppos is in/out string position.
@r%FALSE if skipping the white space leaves the position at a '\0' character..
split_file_list (string str)
Splits a %G_SEARCHPATH_SEPARATOR-separated list of files, stripping white space and substituting ~/ with $HOME/.
@pstr is a %G_SEARCHPATH_SEPARATOR separated list of filenames.
@ra list of strings to be freed with g_strfreev().
tab_array_from_string (string text)
Deserializes a PangoTabArray from a string. This is the counterpart to [method@Pango.TabArray.to_string]. See that functions for details about the format.
@ptext is a string.
@ra new PangoTabArray.
tailor_break (string text, int length, object analysis, int offset, int attrs_len)
Apply language-specific tailoring to the breaks in @attrs. The line breaks are assumed to have been produced by [func@Pango.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
@offsetand use [func@Pango.attr_break] to apply attributes to the whole paragraph.
@ptext is text to process. Must be valid UTF-8.
@plength is length in bytes of @text.
@panalysis is PangoAnalysis for @text.
@poffset is Byte offset of @text from the beginning of the paragraph, or -1 to ignore attributes from @analysis.
@pattrs is array with one PangoLogAttr per character in @text, plus one extra, to be filled in.
@pattrs_len is length of @attrs array.
@rNone.
trim_string (string str)
Trims leading and trailing whitespace from a string.
@pstr is a string.
@rA newly-allocated string that must be freed with g_free().
unichar_direction (int ch)
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, [func@Pango.BidiType.for_unichar] can be used instead.
@pch is a Unicode character.
@rthe direction of the character..
units_from_double (double d)
Converts a floating-point number to Pango units. The conversion is done by multiplying @d by %PANGO_SCALE and rounding the result to nearest integer.
@pd is double floating-point value.
@rthe value in Pango units..
units_to_double (int i)
Converts a number in Pango units to floating-point. The conversion is done by dividing @i by %PANGO_SCALE.
@pi is value in Pango units.
@rthe double value..
version ()
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().
@rThe encoded version of Pango library available at run time..
version_check (int required_major, int required_minor, int required_micro)
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().
@prequired_major is the required major version.
@prequired_minor is the required minor version.
@prequired_micro is the required major version.
@r%NULL if 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..
version_string ()
Returns the version of Pango available at run-time. This is similar to the macro %PANGO_VERSION_STRING except that the macro returns the version available at compile-time.
@rA 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..
itemize_list ()
Returns itemize as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use itemize() when lazy or change-notify access is required.
@rAn Aussom list of elements.
itemize_with_base_dir_list ()
Returns itemize_with_base_dir as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use itemize_with_base_dir() when lazy or change-notify access is required.
@rAn Aussom list of elements.
reorder_items_list ()
Returns reorder_items as an Aussom list of wrapper objects. This companion method materializes the full collection up front; use reorder_items() when lazy or change-notify access is required.
@rAn Aussom list of elements.
class: PangoAttrDataCopyFuncCallback
[12:7] extends: object
Type of a function that can duplicate user data for an attribute.