:right-sidebar: True TabArray =================================================================== .. currentmodule:: gi.repository.Pango .. class:: TabArray(**kwargs) :no-contents-entry: 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 ------------ .. rst-class:: interim-class .. class:: TabArray :no-index: .. classmethod:: new(initial_size: int, positions_in_pixels: bool) -> ~gi.repository.Pango.TabArray Creates an array of ``initial_size`` tab stops. Tab stops are specified in pixel units if ``positions_in_pixels`` is :const:`True`, otherwise in Pango units. All stops are initially at position 0. :param initial_size: Initial number of tab stops to allocate, can be 0 :param positions_in_pixels: whether positions are in pixel units Methods ------- .. rst-class:: interim-class .. class:: TabArray :no-index: .. method:: free() -> None Frees a tab array and associated resources. .. classmethod:: from_string() -> ~gi.repository.Pango.TabArray | None Deserializes a ``PangoTabArray`` from a string. This is the counterpart to :obj:`~gi.repository.Pango.TabArray.to_string`\. See that functions for details about the format. .. versionadded:: 1.50 .. method:: get_decimal_point(tab_index: int) -> str Gets the Unicode character to use as decimal point. This is only relevant for tabs with :const:`~gi.repository.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. .. versionadded:: 1.50 :param tab_index: the index of a tab stop .. method:: get_positions_in_pixels() -> bool Returns :const:`True` if the tab positions are in pixels, :const:`False` if they are in Pango units. .. method:: get_size() -> int Gets the number of tab stops in ``tab_array``\. .. method:: get_tab(tab_index: int) -> ~typing.Tuple[~gi.repository.Pango.TabAlign, int] Gets the alignment and position of a tab stop. :param tab_index: tab stop index .. method:: get_tabs() -> ~typing.Tuple[~gi.repository.Pango.TabAlign, list[int]] If non-:const:`None`, ``alignments`` and ``locations`` are filled with allocated arrays. The arrays are of length :obj:`~gi.repository.Pango.TabArray.get_size`\. You must free the returned array. .. method:: resize(new_size: int) -> None Resizes a tab array. You must subsequently initialize any tabs that were added as a result of growing the array. :param new_size: new size of the array .. method:: set_decimal_point(tab_index: int, decimal_point: str) -> None Sets the Unicode character to use as decimal point. This is only relevant for tabs with :const:`~gi.repository.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. .. versionadded:: 1.50 :param tab_index: the index of a tab stop :param decimal_point: the decimal point to use .. method:: set_positions_in_pixels(positions_in_pixels: bool) -> None Sets whether positions in this array are specified in pixels. .. versionadded:: 1.50 :param positions_in_pixels: whether positions are in pixels .. method:: set_tab(tab_index: int, alignment: ~gi.repository.Pango.TabAlign, location: int) -> None Sets the alignment and location of a tab stop. :param tab_index: the index of a tab stop :param alignment: tab alignment :param location: tab location in Pango units .. method:: sort() -> None Utility function to ensure that the tab stops are in increasing order. .. versionadded:: 1.50 .. method:: to_string() -> str Serializes a ``PangoTabArray`` to a string. No guarantees are made about the format of the string, it may change between Pango versions. The intended use of this function is testing and debugging. The format is not meant as a permanent storage format. .. versionadded:: 1.50