Pango.TabArray¶
record (struct)
A PangoTabArray contains an array of tab stops.
PangoTabArray can be used to set tab stops in a PangoLayout.
Each tab stop has an alignment, a position, and optionally
a character to use as decimal point.
Constructors¶
new¶
Creates an array of initial_size tab stops.
Tab stops are specified in pixel units if positions_in_pixels is True,
otherwise in Pango units. All stops are initially at position 0.
Parameters:
initial_size— Initial number of tab stops to allocate, can be 0positions_in_pixels— whether positions are in pixel units
Methods¶
copy¶
Copies a PangoTabArray.
free¶
Frees a tab array and associated resources.
get_decimal_point¶
Gets the Unicode character to use as decimal point.
This is only relevant for tabs with TabAlign.DECIMAL alignment,
which align content at the first occurrence of the decimal point
character.
The default value of 0 means that Pango will use the decimal point according to the current locale.
Parameters:
tab_index— the index of a tab stop
get_positions_in_pixels¶
Returns True if the tab positions are in pixels,
False if they are in Pango units.
get_size¶
Gets the number of tab stops in tab_array.
get_tab¶
Gets the alignment and position of a tab stop.
Parameters:
tab_index— tab stop index
get_tabs¶
If non-None, alignments and locations are filled with allocated
arrays.
The arrays are of length TabArray.get_size.
You must free the returned array.
resize¶
Resizes a tab array.
You must subsequently initialize any tabs that were added as a result of growing the array.
Parameters:
new_size— new size of the array
set_decimal_point¶
Sets the Unicode character to use as decimal point.
This is only relevant for tabs with TabAlign.DECIMAL alignment,
which align content at the first occurrence of the decimal point
character.
By default, Pango uses the decimal point according to the current locale.
Parameters:
tab_index— the index of a tab stopdecimal_point— the decimal point to use
set_positions_in_pixels¶
Sets whether positions in this array are specified in pixels.
Parameters:
positions_in_pixels— whether positions are in pixels
set_tab¶
Sets the alignment and location of a tab stop.
Parameters:
tab_index— the index of a tab stopalignment— tab alignmentlocation— tab location in Pango units
sort¶
Utility function to ensure that the tab stops are in increasing order.
to_string¶
Serializes a PangoTabArray to a string.
In the resulting string, serialized tabs are separated by newlines or commas.
Individual tabs are serialized to a string of the form
[ALIGNMENT:]POSITION[:DECIMAL_POINT]
Where ALIGNMENT is one of left, right, center or decimal, and POSITION is the position of the tab, optionally followed by the unit px. If ALIGNMENT is omitted, it defaults to left. If ALIGNMENT is decimal, the DECIMAL_POINT character may be specified as a Unicode codepoint.
Note that all tabs in the array must use the same unit.
A typical example:
100px 200px center:300px right:400px
Static functions¶
from_string¶
Deserializes a PangoTabArray from a string.
This is the counterpart to TabArray.to_string.
See that functions for details about the format.
Parameters:
text— a string