Pango.TabArray¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Pango.TabArray¶
A
PangoTabArray
contains an array of tab stops.PangoTabArray
can be used to set tab stops in aPangoLayout
. Each tab stop has an alignment, a position, and optionally a character to use as decimal point.- classmethod from_string(text)[source]¶
- Parameters:
text (
str
) – a string- Returns:
a new
PangoTabArray
- Return type:
Deserializes a
PangoTabArray
from a string.This is the counterpart to [method`Pango`.TabArray.to_string]. See that functions for details about the format.
New in version 1.50.
- classmethod new(initial_size, positions_in_pixels)[source]¶
- Parameters:
- Returns:
the newly allocated
PangoTabArray
, which should be freed with [method`Pango`.TabArray.free].- Return type:
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.
- copy()[source]¶
- Returns:
the newly allocated
PangoTabArray
, which should be freed with [method`Pango`.TabArray.free].- Return type:
Copies a
PangoTabArray
.
- get_decimal_point(tab_index)[source]¶
-
Gets the Unicode character to use as decimal point.
This is only relevant for tabs with
Pango.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.
New in version 1.50.
- get_positions_in_pixels()[source]¶
- Returns:
whether positions are in pixels.
- Return type:
Returns
True
if the tab positions are in pixels,False
if they are in Pango units.
- get_size()[source]¶
- Returns:
the number of tab stops in the array.
- Return type:
Gets the number of tab stops in self.
- get_tab(tab_index)[source]¶
- Parameters:
tab_index (
int
) – tab stop index- Returns:
- alignment:
location to store alignment
- location:
location to store tab position
- Return type:
(alignment:
Pango.TabAlign
, location:int
)
Gets the alignment and position of a tab stop.
- get_tabs()[source]¶
- Returns:
- alignments:
location to store an array of tab stop alignments
- locations:
location to store an array of tab positions
- Return type:
(alignments:
Pango.TabAlign
, locations: [int
])
If non-
None
, alignments and locations are filled with allocated arrays.The arrays are of length [method`Pango`.TabArray.get_size]. You must free the returned array.
- resize(new_size)[source]¶
- Parameters:
new_size (
int
) – new size of the array
Resizes a tab array.
You must subsequently initialize any tabs that were added as a result of growing the array.
- set_decimal_point(tab_index, decimal_point)[source]¶
- Parameters:
Sets the Unicode character to use as decimal point.
This is only relevant for tabs with
Pango.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.
New in version 1.50.
- set_positions_in_pixels(positions_in_pixels)[source]¶
- Parameters:
positions_in_pixels (
bool
) – whether positions are in pixels
Sets whether positions in this array are specified in pixels.
New in version 1.50.
- set_tab(tab_index, alignment, location)[source]¶
- Parameters:
tab_index (
int
) – the index of a tab stopalignment (
Pango.TabAlign
) – tab alignmentlocation (
int
) – tab location in Pango units
Sets the alignment and location of a tab stop.
- sort()[source]¶
Utility function to ensure that the tab stops are in increasing order.
New in version 1.50.
- to_string()[source]¶
- Returns:
a newly allocated string
- Return type:
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
New in version 1.50.