Package com.reportmill.text
Class RMTextLayout
- java.lang.Object
- 
- com.reportmill.base.RMObject
- 
- com.reportmill.text.RMTextLayout
 
 
- 
- All Implemented Interfaces:
- RMArchiver.Archiving,- java.lang.Cloneable
 
 public class RMTextLayout extends RMObject This class lays out characters in an RMXString inside a bounding rect.
- 
- 
Field SummaryFields Modifier and Type Field Description static byteALIGN_BOTTOMstatic byteALIGN_MIDDLEstatic byteALIGN_TOP
 - 
Constructor SummaryConstructors Constructor Description RMTextLayout()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RMTextLineaddLine()Adds an empty line to the layout.RMRectgetBounds()Returns the text bounds for the text layout.intgetCharForPoint(float x, float y)Returns the character index for the given x/y point.static RMColorgetColor(java.util.Map attrs)Returns the color associated with the given attributes (or black by default).intgetEnd()Returns the last character laid out.static RMFontgetFont(RMXString xString, int charPos)Returns the font associated with the attributes at the given character position for the given XString.static RMFontgetFont(java.util.Map attrs)Returns the font associated with the given attributes (Helvetica12 by default).static RMFontgetFont(java.util.Map attrs, float fontScale)Returns the font associated with the given attributes (Helvetica12 by default).floatgetHeight()Returns the height of the layout.floatgetHeightToFit()Returns height required to show all text.floatgetHitX(float x, float y)Returns the x hit for the horizontal line from given point to positve infinity.RMTextLinegetLine(int anIndex)Returns the specific text line at the given index.intgetLineCount()Returns the number of lines in the layout.RMTextLinegetLineForChar(int index)Returns the line for the given character index.RMTextLinegetLineForChar(int index, RMPoint suggestedPoint)Returns the line for the given character index, with an optional point as a hint.RMTextLinegetLineForPointY(float y)Returns the line index for the given y value.floatgetLineHeightForChar(int index)Returns the height of the line at the given character index.floatgetLineHeightForChars(int start, int end)Returns the height of the line for the given range of characters.intgetLineIndexForChar(int index)Returns the line index for the given character index.intgetLineIndexForChar(int index, RMPoint suggestedPoint)Returns the line index for the given character index, with an optional point as a hint.RMTextLinegetLineLast()Returns the last text line.floatgetLineYForChar(int pos)Returns the top of the line for the given character index.booleangetLongWordFound()Returns whether a word was found that over-ran a whole line by itself.floatgetMaxX()Returns the max x of the layout.floatgetMaxY()Returns the max y of the layout.RMTextFraggetNextFrag()Returns the next frag in the layout (use this to iterate until it returns null).static RMXString.OutlinegetOutline(java.util.Map attrs)Returns the Outline record for the given attributes map (or null for none).static RMParagraphgetParagraph(java.util.Map attrs)Returns the paragraph from the given attributes map.RMPathgetPath()Returns the path that the text should wrap to.RMPointgetPointForChar(int index)Returns the text origin for the given character index.RMPointgetPointForChar(int index, RMPoint suggestedPoint)Returns the text origin for the given character index.static intgetScripting(java.util.Map attrs)Returns the "scripting" of the given attributes map (1==super, -1==sub, 0==none).intgetStart()Returns the starting character index.static RMTextLayoutgetThreadInstance()Returns the RMTextLayout shared by the current thread.static intgetUnderlineStyle(java.util.Map attrs)Returns the underline style of the given attributes map.floatgetWidth()Returns the width of the layout.floatgetWidthToFit()Returns the width required to show text without wrapping.floatgetX()Returns the x position of the layout.RMXStringgetXString()Returns the XString to be layed out.floatgetY()Returns the y position of the layout.booleanisAllTextVisible()Returns whether all text was rendered within text bounds or path.static booleanisUnderlined(java.util.Map attrs)Returns whether the attributes map contains an underline attribute.intlength()Returns the length of the chars that the layout is working with.voidlinesRemoveAll()Removes all lines from the layout.voidlinesRemoveLast()Removes the last line from the layout.voidperformLayout()Re-lays out text for current string and attributes (if necessary).voidrebuild()Rebuilds the lines and frags of the layout (defers until needed).voidsetAlignVertical(int anAlign)Sets the vertical alignment of text.voidsetBounds(RMRect aRect)Sets the text bounds for the text layout.voidsetDrawFinalEmptyLine(boolean aFlag)Sets whether the layout should include the last line even if it's just a newline.voidsetFontScale(float aValue)Sets the font scale of the text layout.voidsetGrowHorizontal(boolean aFlag)Sets whether text can grow horizontally.voidsetGrowVertical(boolean aFlag)Sets whether text can grow vertically.voidsetPath(RMPath aPath)Sets the path that the text should wrap to.voidsetStartIndex(int anIndex)Sets the starting character index.voidsetXString(RMXString aString)Sets the XString to be layed out.- 
Methods inherited from class com.reportmill.base.RMObjectclone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, initWithArchiver, undoClone, undoCopy, undoEquals
 
- 
 
- 
- 
- 
Field Detail- 
ALIGN_TOPpublic static final byte ALIGN_TOP - See Also:
- Constant Field Values
 
 - 
ALIGN_MIDDLEpublic static final byte ALIGN_MIDDLE - See Also:
- Constant Field Values
 
 - 
ALIGN_BOTTOMpublic static final byte ALIGN_BOTTOM - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getThreadInstancepublic static RMTextLayout getThreadInstance() Returns the RMTextLayout shared by the current thread.
 - 
getXStringpublic RMXString getXString() Returns the XString to be layed out.
 - 
setXStringpublic void setXString(RMXString aString) Sets the XString to be layed out.
 - 
getXpublic float getX() Returns the x position of the layout.
 - 
getYpublic float getY() Returns the y position of the layout.
 - 
getWidthpublic float getWidth() Returns the width of the layout.
 - 
getHeightpublic float getHeight() Returns the height of the layout.
 - 
getMaxXpublic float getMaxX() Returns the max x of the layout.
 - 
getMaxYpublic float getMaxY() Returns the max y of the layout.
 - 
getBoundspublic RMRect getBounds() Returns the text bounds for the text layout.
 - 
setBoundspublic void setBounds(RMRect aRect) Sets the text bounds for the text layout.
 - 
getWidthToFitpublic float getWidthToFit() Returns the width required to show text without wrapping.
 - 
getHeightToFitpublic float getHeightToFit() Returns height required to show all text.
 - 
getPathpublic RMPath getPath() Returns the path that the text should wrap to.
 - 
setPathpublic void setPath(RMPath aPath) Sets the path that the text should wrap to.
 - 
setGrowVerticalpublic void setGrowVertical(boolean aFlag) Sets whether text can grow vertically.
 - 
setGrowHorizontalpublic void setGrowHorizontal(boolean aFlag) Sets whether text can grow horizontally.
 - 
setAlignVerticalpublic void setAlignVertical(int anAlign) Sets the vertical alignment of text.
 - 
setDrawFinalEmptyLinepublic void setDrawFinalEmptyLine(boolean aFlag) Sets whether the layout should include the last line even if it's just a newline.
 - 
setFontScalepublic void setFontScale(float aValue) Sets the font scale of the text layout.
 - 
lengthpublic int length() Returns the length of the chars that the layout is working with.
 - 
getStartpublic int getStart() Returns the starting character index.
 - 
setStartIndexpublic void setStartIndex(int anIndex) Sets the starting character index.
 - 
getEndpublic int getEnd() Returns the last character laid out.
 - 
isAllTextVisiblepublic boolean isAllTextVisible() Returns whether all text was rendered within text bounds or path.
 - 
rebuildpublic void rebuild() Rebuilds the lines and frags of the layout (defers until needed).
 - 
performLayoutpublic void performLayout() Re-lays out text for current string and attributes (if necessary). Called before enumerating frags.
 - 
getNextFragpublic RMTextFrag getNextFrag() Returns the next frag in the layout (use this to iterate until it returns null).
 - 
getLineCountpublic int getLineCount() Returns the number of lines in the layout.
 - 
getLinepublic RMTextLine getLine(int anIndex) Returns the specific text line at the given index.
 - 
getLineLastpublic RMTextLine getLineLast() Returns the last text line.
 - 
addLinepublic RMTextLine addLine() Adds an empty line to the layout.
 - 
linesRemoveAllpublic void linesRemoveAll() Removes all lines from the layout.
 - 
linesRemoveLastpublic void linesRemoveLast() Removes the last line from the layout.
 - 
getLineForCharpublic RMTextLine getLineForChar(int index) Returns the line for the given character index.
 - 
getLineForCharpublic RMTextLine getLineForChar(int index, RMPoint suggestedPoint) Returns the line for the given character index, with an optional point as a hint.
 - 
getLineForPointYpublic RMTextLine getLineForPointY(float y) Returns the line index for the given y value.
 - 
getLineIndexForCharpublic int getLineIndexForChar(int index) Returns the line index for the given character index.
 - 
getLineIndexForCharpublic int getLineIndexForChar(int index, RMPoint suggestedPoint)Returns the line index for the given character index, with an optional point as a hint.
 - 
getPointForCharpublic RMPoint getPointForChar(int index) Returns the text origin for the given character index.
 - 
getPointForCharpublic RMPoint getPointForChar(int index, RMPoint suggestedPoint) Returns the text origin for the given character index.
 - 
getCharForPointpublic int getCharForPoint(float x, float y)Returns the character index for the given x/y point.
 - 
getLineHeightForCharpublic float getLineHeightForChar(int index) Returns the height of the line at the given character index.
 - 
getLineHeightForCharspublic float getLineHeightForChars(int start, int end)Returns the height of the line for the given range of characters.
 - 
getLineYForCharpublic float getLineYForChar(int pos) Returns the top of the line for the given character index.
 - 
getHitXpublic float getHitX(float x, float y)Returns the x hit for the horizontal line from given point to positve infinity.
 - 
getLongWordFoundpublic boolean getLongWordFound() Returns whether a word was found that over-ran a whole line by itself.
 - 
getColorpublic static RMColor getColor(java.util.Map attrs) Returns the color associated with the given attributes (or black by default).
 - 
getFontpublic static RMFont getFont(java.util.Map attrs) Returns the font associated with the given attributes (Helvetica12 by default).
 - 
getFontpublic static RMFont getFont(java.util.Map attrs, float fontScale) Returns the font associated with the given attributes (Helvetica12 by default).
 - 
getFontpublic static RMFont getFont(RMXString xString, int charPos) Returns the font associated with the attributes at the given character position for the given XString.
 - 
getParagraphpublic static RMParagraph getParagraph(java.util.Map attrs) Returns the paragraph from the given attributes map.
 - 
isUnderlinedpublic static boolean isUnderlined(java.util.Map attrs) Returns whether the attributes map contains an underline attribute.
 - 
getUnderlineStylepublic static int getUnderlineStyle(java.util.Map attrs) Returns the underline style of the given attributes map.
 - 
getOutlinepublic static RMXString.Outline getOutline(java.util.Map attrs) Returns the Outline record for the given attributes map (or null for none).
 - 
getScriptingpublic static int getScripting(java.util.Map attrs) Returns the "scripting" of the given attributes map (1==super, -1==sub, 0==none).
 
- 
 
-