Package icyllis.modernui.text
Class Directions
java.lang.Object
icyllis.modernui.text.Directions
Stores information about bidirectional (left-to-right or right-to-left)
text within the layout of a line in rendering order.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Directions
static final Directions
int[]
Directions represents directional runs within a line of text. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns number of BiDi runs.int
getRunLength
(int runIndex) Returns the length of the BiDi run.int
getRunStart
(int runIndex) Returns the start offset of the BiDi run.boolean
isRunRtl
(int runIndex) Returns true if the BiDi run is RTL.
-
Field Details
-
ALL_LEFT_TO_RIGHT
-
ALL_RIGHT_TO_LEFT
-
mDirections
public int[] mDirectionsDirections represents directional runs within a line of text. Runs are pairs of ints listed in visual order, starting from the leading margin. The first int of each pair is the offset from the first character of the line to the start of the run. The second int represents both the length and level of the run. The length is in the lower bits, accessed by masking with RUN_LENGTH_MASK. The level is in the higher bits, accessed by shifting by RUN_LEVEL_SHIFT and masking by RUN_LEVEL_MASK. To simply test for an RTL direction, test the bit using RUN_RTL_FLAG, if set then the direction is rtl.
-
-
Constructor Details
-
Directions
public Directions(int[] dirs) - See Also:
-
-
Method Details
-
getRunCount
public int getRunCount()Returns number of BiDi runs. -
getRunStart
public int getRunStart(int runIndex) Returns the start offset of the BiDi run.- Parameters:
runIndex
- the index of the BiDi run- Returns:
- the start offset of the BiDi run.
-
getRunLength
public int getRunLength(int runIndex) Returns the length of the BiDi run.Note that this method may return too large number due to reducing the number of object allocations. The too large number means the remaining part is assigned to this run. The caller must clamp the returned value.
- Parameters:
runIndex
- the index of the BiDi run- Returns:
- the length of the BiDi run.
-
isRunRtl
public boolean isRunRtl(int runIndex) Returns true if the BiDi run is RTL.- Parameters:
runIndex
- the index of the BiDi run- Returns:
- true if the BiDi run is RTL.
-