Package icyllis.modernui.graphics.text
Class LayoutPiece
java.lang.Object
icyllis.modernui.graphics.text.LayoutPiece
The layout of a styled text run, including text shaping results, glyph metrics and
their positions.
- Since:
- 2.6
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the total advance of this piece.@org.jetbrains.annotations.Unmodifiable float[]
The array of all chars advance, the length and order are relative to the text buffer, if computed.int
Gets the font metrics of the maximum extent of this piece.int
Returns the height value of the pixel bounds of all glyph images, if computed.int
Returns the width value of the pixel bounds of all glyph images, if computed.int
Returns the floor left value of the pixel bounds of all glyph images, relative to (0, 0), if computed.int
Returns the floor top value of the pixel bounds of all glyph images, relative to (0, 0), if computed.int
Returns the number of characters (i.e.int
Returns which flags were computed.int
Gets the font metrics of the maximum extent of this piece.void
getExtent
(FontMetricsInt extent) Expands the font metrics of the maximum extent of this piece.getFont
(int i) Returns which font should be used for the i-th glyph.int
Returns the number of glyphs.@org.jetbrains.annotations.Unmodifiable int[]
The array is about all laid-out glyphs for in order visually from left to right.int
@org.jetbrains.annotations.Unmodifiable float[]
This array holds the repeat of x offset, y offset of glyph positions.toString()
-
Method Details
-
getGlyphCount
public int getGlyphCount()Returns the number of glyphs. -
getGlyphs
public @org.jetbrains.annotations.Unmodifiable int[] getGlyphs()The array is about all laid-out glyphs for in order visually from left to right.- Returns:
- glyphs
-
getPositions
public @org.jetbrains.annotations.Unmodifiable float[] getPositions()This array holds the repeat of x offset, y offset of glyph positions. The length is twice as long as the glyph array.- Returns:
- glyph positions
-
getFont
Returns which font should be used for the i-th glyph.- Parameters:
i
- the index- Returns:
- the font
-
getCharCount
public int getCharCount()Returns the number of characters (i.e. constructorlimit - start
in code units). -
getAdvances
public @org.jetbrains.annotations.Unmodifiable float[] getAdvances()The array of all chars advance, the length and order are relative to the text buffer, if computed. Only grapheme cluster bounds have advances, others are zeros. For example: [13.57, 0, 14.26, 0, 0]. The length is constructorend - start
.- Returns:
- advances, or null
- See Also:
-
getExtent
Expands the font metrics of the maximum extent of this piece.- Parameters:
extent
- to expand from
-
getAscent
public int getAscent()Gets the font metrics of the maximum extent of this piece.- Returns:
- ascent to baseline, always negative
-
getDescent
public int getDescent()Gets the font metrics of the maximum extent of this piece.- Returns:
- descent to baseline, always positive
-
getAdvance
public float getAdvance()Returns the total advance of this piece.- Returns:
- advance
-
getBoundsX
public int getBoundsX()Returns the floor left value of the pixel bounds of all glyph images, relative to (0, 0), if computed.- Returns:
- the bounds X, or 0
- See Also:
-
getBoundsY
public int getBoundsY()Returns the floor top value of the pixel bounds of all glyph images, relative to (0, 0), if computed.- Returns:
- the bounds Y, or 0
- See Also:
-
getBoundsWidth
public int getBoundsWidth()Returns the width value of the pixel bounds of all glyph images, if computed.- Returns:
- the bounds width, or 0
- See Also:
-
getBoundsHeight
public int getBoundsHeight()Returns the height value of the pixel bounds of all glyph images, if computed.- Returns:
- the bounds height, or 0
- See Also:
-
getComputeFlags
public int getComputeFlags()Returns which flags were computed.- See Also:
-
getMemoryUsage
public int getMemoryUsage() -
toString
-