public class SimpleTextManager extends java.lang.Object implements TextManager
Constructor and Description |
---|
SimpleTextManager() |
Modifier and Type | Method and Description |
---|---|
Rectangle |
computeContentSize(java.lang.String text,
Font font,
Rectangle availableSize)
Computes a text size for a font.
|
void |
drawText(GraphicsContext g,
java.lang.String text,
Font font,
int color,
Rectangle area,
int alignment)
Draws text on a graphics context.
|
boolean |
equals(java.lang.Object obj) |
Rectangle[] |
getBounds(int startIndex,
int endIndex,
java.lang.String text,
Font font,
Rectangle area,
int alignment)
Gets the bounds surrounding a part of the text.
|
int |
getIndex(int x,
int y,
java.lang.String text,
Font font,
Rectangle area,
int alignment)
Gets the index of the character at a location.
|
int |
hashCode() |
public void drawText(GraphicsContext g, java.lang.String text, Font font, int color, Rectangle area, int alignment)
TextManager
The given graphics context is translated and clipped according to the given area.
drawText
in interface TextManager
g
- the graphics context to draw the text on.text
- the text to render.font
- the font to use.color
- the color to use.area
- the text area.alignment
- the text alignment.public Rectangle computeContentSize(java.lang.String text, Font font, Rectangle availableSize)
TextManager
computeContentSize
in interface TextManager
text
- the text.font
- the font.availableSize
- the available size.public int getIndex(int x, int y, java.lang.String text, Font font, Rectangle area, int alignment)
TextManager
getIndex
in interface TextManager
x
- the x coordinate of the location to search the character at.y
- the x coordinate of the location to search the character at.text
- the text to search the character in.font
- the font.area
- the text area.alignment
- the text alignment.public Rectangle[] getBounds(int startIndex, int endIndex, java.lang.String text, Font font, Rectangle area, int alignment)
TextManager
getBounds
in interface TextManager
startIndex
- the sub text start index.endIndex
- the sub text end index.text
- the text.font
- the font.area
- the text area.alignment
- the text alignment.public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object