public class RMTextLayout extends RMObject
Modifier and Type | Field and Description |
---|---|
static byte |
ALIGN_BOTTOM |
static byte |
ALIGN_MIDDLE |
static byte |
ALIGN_TOP |
Constructor and Description |
---|
RMTextLayout() |
Modifier and Type | Method and Description |
---|---|
RMTextLine |
addLine()
Adds an empty line to the layout.
|
RMRect |
getBounds()
Returns the text bounds for the text layout.
|
int |
getCharForPoint(float x,
float y)
Returns the character index for the given x/y point.
|
static RMColor |
getColor(java.util.Map attrs)
Returns the color associated with the given attributes (or black by default).
|
int |
getEnd()
Returns the last character laid out.
|
static RMFont |
getFont(java.util.Map attrs)
Returns the font associated with the given attributes (Helvetica12 by default).
|
static RMFont |
getFont(java.util.Map attrs,
float fontScale)
Returns the font associated with the given attributes (Helvetica12 by default).
|
static RMFont |
getFont(RMXString xString,
int charPos)
Returns the font associated with the attributes at the given character position for the given XString.
|
float |
getHeight()
Returns the height of the layout.
|
float |
getHeightToFit()
Returns height required to show all text.
|
float |
getHitX(float x,
float y)
Returns the x hit for the horizontal line from given point to positve infinity.
|
RMTextLine |
getLine(int anIndex)
Returns the specific text line at the given index.
|
int |
getLineCount()
Returns the number of lines in the layout.
|
RMTextLine |
getLineForChar(int index)
Returns the line for the given character index.
|
RMTextLine |
getLineForChar(int index,
RMPoint suggestedPoint)
Returns the line for the given character index, with an optional point as a hint.
|
RMTextLine |
getLineForPointY(float y)
Returns the line index for the given y value.
|
float |
getLineHeightForChar(int index)
Returns the height of the line at the given character index.
|
float |
getLineHeightForChars(int start,
int end)
Returns the height of the line for the given range of characters.
|
int |
getLineIndexForChar(int index)
Returns the line index for the given character index.
|
int |
getLineIndexForChar(int index,
RMPoint suggestedPoint)
Returns the line index for the given character index, with an optional point as a hint.
|
RMTextLine |
getLineLast()
Returns the last text line.
|
float |
getLineYForChar(int pos)
Returns the top of the line for the given character index.
|
boolean |
getLongWordFound()
Returns whether a word was found that over-ran a whole line by itself.
|
float |
getMaxX()
Returns the max x of the layout.
|
float |
getMaxY()
Returns the max y of the layout.
|
RMTextFrag |
getNextFrag()
Returns the next frag in the layout (use this to iterate until it returns null).
|
static RMXString.Outline |
getOutline(java.util.Map attrs)
Returns the Outline record for the given attributes map (or null for none).
|
static RMParagraph |
getParagraph(java.util.Map attrs)
Returns the paragraph from the given attributes map.
|
RMPath |
getPath()
Returns the path that the text should wrap to.
|
RMPoint |
getPointForChar(int index)
Returns the text origin for the given character index.
|
RMPoint |
getPointForChar(int index,
RMPoint suggestedPoint)
Returns the text origin for the given character index.
|
static int |
getScripting(java.util.Map attrs)
Returns the "scripting" of the given attributes map (1==super, -1==sub, 0==none).
|
int |
getStart()
Returns the starting character index.
|
static RMTextLayout |
getThreadInstance()
Returns the RMTextLayout shared by the current thread.
|
static int |
getUnderlineStyle(java.util.Map attrs)
Returns the underline style of the given attributes map.
|
float |
getWidth()
Returns the width of the layout.
|
float |
getWidthToFit()
Returns the width required to show text without wrapping.
|
float |
getX()
Returns the x position of the layout.
|
RMXString |
getXString()
Returns the XString to be layed out.
|
float |
getY()
Returns the y position of the layout.
|
boolean |
isAllTextVisible()
Returns whether all text was rendered within text bounds or path.
|
static boolean |
isUnderlined(java.util.Map attrs)
Returns whether the attributes map contains an underline attribute.
|
int |
length()
Returns the length of the chars that the layout is working with.
|
void |
linesRemoveAll()
Removes all lines from the layout.
|
void |
linesRemoveLast()
Removes the last line from the layout.
|
void |
performLayout()
Re-lays out text for current string and attributes (if necessary).
|
void |
rebuild()
Rebuilds the lines and frags of the layout (defers until needed).
|
void |
setAlignVertical(int anAlign)
Sets the vertical alignment of text.
|
void |
setBounds(RMRect aRect)
Sets the text bounds for the text layout.
|
void |
setDrawFinalEmptyLine(boolean aFlag)
Sets whether the layout should include the last line even if it's just a newline.
|
void |
setFontScale(float aValue)
Sets the font scale of the text layout.
|
void |
setGrowHorizontal(boolean aFlag)
Sets whether text can grow horizontally.
|
void |
setGrowVertical(boolean aFlag)
Sets whether text can grow vertically.
|
void |
setPath(RMPath aPath)
Sets the path that the text should wrap to.
|
void |
setStartIndex(int anIndex)
Sets the starting character index.
|
void |
setXString(RMXString aString)
Sets the XString to be layed out.
|
clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, initWithArchiver, undoClone, undoCopy, undoEquals
public static final byte ALIGN_TOP
public static final byte ALIGN_MIDDLE
public static final byte ALIGN_BOTTOM
public static RMTextLayout getThreadInstance()
public RMXString getXString()
public void setXString(RMXString aString)
public float getX()
public float getY()
public float getWidth()
public float getHeight()
public float getMaxX()
public float getMaxY()
public RMRect getBounds()
public void setBounds(RMRect aRect)
public float getWidthToFit()
public float getHeightToFit()
public RMPath getPath()
public void setPath(RMPath aPath)
public void setGrowVertical(boolean aFlag)
public void setGrowHorizontal(boolean aFlag)
public void setAlignVertical(int anAlign)
public void setDrawFinalEmptyLine(boolean aFlag)
public void setFontScale(float aValue)
public int length()
public int getStart()
public void setStartIndex(int anIndex)
public int getEnd()
public boolean isAllTextVisible()
public void rebuild()
public void performLayout()
public RMTextFrag getNextFrag()
public int getLineCount()
public RMTextLine getLine(int anIndex)
public RMTextLine getLineLast()
public RMTextLine addLine()
public void linesRemoveAll()
public void linesRemoveLast()
public RMTextLine getLineForChar(int index)
public RMTextLine getLineForChar(int index, RMPoint suggestedPoint)
public RMTextLine getLineForPointY(float y)
public int getLineIndexForChar(int index)
public int getLineIndexForChar(int index, RMPoint suggestedPoint)
public RMPoint getPointForChar(int index)
public RMPoint getPointForChar(int index, RMPoint suggestedPoint)
public int getCharForPoint(float x, float y)
public float getLineHeightForChar(int index)
public float getLineHeightForChars(int start, int end)
public float getLineYForChar(int pos)
public float getHitX(float x, float y)
public boolean getLongWordFound()
public static RMColor getColor(java.util.Map attrs)
public static RMFont getFont(java.util.Map attrs)
public static RMFont getFont(java.util.Map attrs, float fontScale)
public static RMFont getFont(RMXString xString, int charPos)
public static RMParagraph getParagraph(java.util.Map attrs)
public static boolean isUnderlined(java.util.Map attrs)
public static int getUnderlineStyle(java.util.Map attrs)
public static RMXString.Outline getOutline(java.util.Map attrs)
public static int getScripting(java.util.Map attrs)