Pango.ScriptIter

Fields

None

Methods

class new (text, length)
  free ()
  get_range ()
  next ()

Details

class Pango.ScriptIter

A Pango.ScriptIter is used to iterate through a string and identify ranges in different scripts.

classmethod new(text, length)[source]
Parameters:
  • text (str) – a UTF-8 string
  • length (int) – length of text, or -1 if text is nul-terminated.
Returns:

the new script iterator, initialized to point at the first range in the text, which should be freed with Pango.ScriptIter.free(). If the string is empty, it will point at an empty range.

Return type:

Pango.ScriptIter

Create a new Pango.ScriptIter, used to break a string of Unicode text into runs by Unicode script. No copy is made of text, so the caller needs to make sure it remains valid until the iterator is freed with Pango.ScriptIter.free().

New in version 1.4.

free()[source]

Frees a Pango.ScriptIter created with Pango.ScriptIter.new().

New in version 1.4.

get_range()[source]
Returns:
start:location to store start position of the range, or None
end:location to store end position of the range, or None
script:location to store script for range, or None
Return type:(start: str, end: str, script: Pango.Script)

Gets information about the range to which self currently points. The range is the set of locations p where *start <= p < *end. (That is, it doesn’t include the character stored at *end)

Note that while the type of the script argument is declared as Pango.Script, as of Pango 1.18, this function simply returns GLib.UnicodeScript values. Callers must be prepared to handle unknown values.

New in version 1.4.

next()[source]
Returns:True if self was successfully advanced.
Return type:bool

Advances a Pango.ScriptIter to the next range. If self is already at the end, it is left unchanged and False is returned.

New in version 1.4.