Record Class ShapedText.Caret
- Record Components:
upstreamX- x of the trailing edge of the character before the index; at index0there is none, and this is the paragraph's own start edge in the base directiondownstreamX- x of the leading edge of the character at the index; at the end of the text there is none, and this is the paragraph's own end edge in the base directiondownstreamIsStrong- whetherdownstreamXis the strong side: the one whose bidi level has the base direction's parity, and the lower level of the two when both do
- Enclosing class:
ShapedText
Both are true, and that is the point. At the end of Latin text followed by Hebrew, a
left-to-right keystroke appears where the Latin run ends and a right-to-left keystroke appears
where the Hebrew run ends; those are different points on the line, and a caret drawn at one of
them alone tells the user the wrong thing about where the next character will land. Drawing
strongX() full height and weakX() as a smaller mark is the usual answer;
drawing only the strong one is a decision to lie in the mixed case.
Off a boundary the two are the same point, and they are the same float, copied
from one caret stop — so split() is an exact comparison rather than a float
equality test standing in for one, and a boolean field that could contradict the two positions
does not exist.
-
Constructor Summary
ConstructorsConstructorDescriptionCaret(float upstreamX, float downstreamX, boolean downstreamIsStrong) Creates an instance of aCaretrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thedownstreamIsStrongrecord component.floatReturns the value of thedownstreamXrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleansplit()Whether the two positions differ, and a second mark therefore has to be drawn.floatstrongX()Where a keystroke in the base direction lands: the caret to draw at full height.final StringtoString()Returns a string representation of this record class.floatReturns the value of theupstreamXrecord component.floatweakX()Where a keystroke in the other direction lands; equal tostrongX()off a boundary.floatx(ShapedText.Affinity affinity) The one position a caller with a stored side means.
-
Constructor Details
-
Caret
public Caret(float upstreamX, float downstreamX, boolean downstreamIsStrong) Creates an instance of aCaretrecord class.- Parameters:
upstreamX- the value for theupstreamXrecord componentdownstreamX- the value for thedownstreamXrecord componentdownstreamIsStrong- the value for thedownstreamIsStrongrecord component
-
-
Method Details
-
split
public boolean split()Whether the two positions differ, and a second mark therefore has to be drawn. -
strongX
public float strongX()Where a keystroke in the base direction lands: the caret to draw at full height. -
weakX
public float weakX()Where a keystroke in the other direction lands; equal tostrongX()off a boundary. -
x
The one position a caller with a stored side means.- Parameters:
affinity- which side of the index the caret is on
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
upstreamX
public float upstreamX()Returns the value of theupstreamXrecord component.- Returns:
- the value of the
upstreamXrecord component
-
downstreamX
public float downstreamX()Returns the value of thedownstreamXrecord component.- Returns:
- the value of the
downstreamXrecord component
-
downstreamIsStrong
public boolean downstreamIsStrong()Returns the value of thedownstreamIsStrongrecord component.- Returns:
- the value of the
downstreamIsStrongrecord component
-