Class TabArray
- All Implemented Interfaces:
Proxy
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.
-
Constructor Summary
ConstructorDescriptionTabArray
(int initialSize, boolean positionsInPixels) Creates an array ofinitialSize
tab stops.TabArray
(MemorySegment address) Create a TabArray proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Copies aPangoTabArray
.void
free()
Frees a tab array and associated resources.static TabArray
fromString
(String text) Deserializes aPangoTabArray
from a string.int
getDecimalPoint
(int tabIndex) Gets the Unicode character to use as decimal point.boolean
Returnstrue
if the tab positions are in pixels,false
if they are in Pango units.int
getSize()
Gets the number of tab stops in this TabArray.void
Gets the alignment and position of a tab stop.void
If non-null
,alignments
andlocations
are filled with allocated arrays.static Type
getType()
Get the GType of the TabArray classvoid
resize
(int newSize) Resizes a tab array.void
setDecimalPoint
(int tabIndex, int decimalPoint) Sets the Unicode character to use as decimal point.void
setPositionsInPixels
(boolean positionsInPixels) Sets whether positions in this array are specified in pixels.void
Sets the alignment and location of a tab stop.void
sort()
Utility function to ensure that the tab stops are in increasing order.toString()
Serializes aPangoTabArray
to a string.static TabArray
withPositions
(int size, boolean positionsInPixels, TabAlign firstAlignment, int firstPosition, Object... varargs) Creates aPangoTabArray
and allows you to specify the alignment and position of each tab stop.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
TabArray
Create a TabArray proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
TabArray
public TabArray(int initialSize, boolean positionsInPixels) Creates an array ofinitialSize
tab stops.Tab stops are specified in pixel units if
positionsInPixels
istrue
, otherwise in Pango units. All stops are initially at position 0.- Parameters:
initialSize
- Initial number of tab stops to allocate, can be 0positionsInPixels
- whether positions are in pixel units
-
-
Method Details
-
getType
-
withPositions
public static TabArray withPositions(int size, boolean positionsInPixels, TabAlign firstAlignment, int firstPosition, Object... varargs) Creates aPangoTabArray
and allows you to specify the alignment and position of each tab stop.You must provide an alignment and position for
size
tab stops.- Parameters:
size
- number of tab stops in the arraypositionsInPixels
- whether positions are in pixel unitsfirstAlignment
- alignment of first tab stopfirstPosition
- position of first tab stopvarargs
- additional alignment/position pairs- Returns:
- the newly allocated
PangoTabArray
, which should be freed withfree()
.
-
fromString
Deserializes aPangoTabArray
from a string.This is the counterpart to
toString()
. See that functions for details about the format.- Parameters:
text
- a string- Returns:
- a new
PangoTabArray
-
copy
-
free
public void free()Frees a tab array and associated resources. -
getDecimalPoint
public int getDecimalPoint(int tabIndex) 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:
tabIndex
- the index of a tab stop
-
getPositionsInPixels
public boolean getPositionsInPixels()Returnstrue
if the tab positions are in pixels,false
if they are in Pango units.- Returns:
- whether positions are in pixels.
-
getSize
public int getSize()Gets the number of tab stops in this TabArray.- Returns:
- the number of tab stops in the array.
-
getTab
-
getTabs
public void getTabs(@Nullable @Nullable Out<TabAlign> alignments, @Nullable @org.jetbrains.annotations.Nullable int[] locations) If non-null
,alignments
andlocations
are filled with allocated arrays.The arrays are of length
getSize()
. You must free the returned array.- Parameters:
alignments
- location to store an array of tab stop alignmentslocations
- location to store an array of tab positions
-
resize
public void resize(int newSize) Resizes a tab array.You must subsequently initialize any tabs that were added as a result of growing the array.
- Parameters:
newSize
- new size of the array
-
setDecimalPoint
public void setDecimalPoint(int tabIndex, int decimalPoint) 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:
tabIndex
- the index of a tab stopdecimalPoint
- the decimal point to use
-
setPositionsInPixels
public void setPositionsInPixels(boolean positionsInPixels) Sets whether positions in this array are specified in pixels.- Parameters:
positionsInPixels
- whether positions are in pixels
-
setTab
Sets the alignment and location of a tab stop.- Parameters:
tabIndex
- the index of a tab stopalignment
- tab alignmentlocation
- tab location in Pango units
-
sort
public void sort()Utility function to ensure that the tab stops are in increasing order. -
toString
Serializes aPangoTabArray
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.
-