Package com.reportmill.text
Class RMTextFrag
- java.lang.Object
-
- com.reportmill.base.RMObject
-
- com.reportmill.text.RMTextFrag
-
- All Implemented Interfaces:
RMArchiver.Archiving,java.lang.Cloneable
public class RMTextFrag extends RMObject
This class represents a group of characters in a text line that all share the same text attributes and are simply spaced apart by their char widths.
-
-
Constructor Summary
Constructors Constructor Description RMTextFrag(RMTextLine aLine)Creates an empty text frag for a given layout and line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description charcharAt(int anIndex)Returns an individual char at the given index.char[]chars()Returns the original layout char array.intgetCharForX(float xOrigin)Returns the character for the given x position.floatgetCharSpacing()Returns the frag's char spacing.RMColorgetColor()Returns the color for this frag.intgetEnd()Returns the end char index for this frag.RMFontgetFont()Returns the font for this frag.floatgetHeight()Returns the height for this frag.booleangetHyphenated()Returns whether this frag has a hyphen at the end.RMTextLayoutgetLayout()Returns the layout for this frag.RMTextLinegetLine()Returns the line for this frag.floatgetMaxX()Returns the maxX position for this frag (in the same coords as the layout frame).RMXString.OutlinegetOutline()Returns whether the frag should be outline.intgetStart()Returns the start char index for this frag.floatgetTab()Returns the tab location if this frag is a tab.chargetTabType()Returns tab type if this frag is a tab.floatgetUnderlineStroke()Returns the stroke width for the underline.floatgetUnderlineY()Returns the Y position for the underline.floatgetWidth()Returns the width for this frag.floatgetX()Returns the x position for this frag (in the same coords as the layout frame).floatgetXForChar(int charpos)Returns the x position of the given character index.floatgetY()Returns the minY position for this frag (in the same coords as the layout frame).floatgetYBaseline()Returns the y position for this frag (in the same coords as the layout frame).java.awt.font.GlyphVectorglyphVector(java.awt.Graphics2D g)Returns the glyph vector for the frag.booleanisColorChanged()Returns whether the color for this frag has changed from the last one.booleanisFontChanged()Returns whether the font for this frag has changed from the last one.booleanisTab()Returns whether frag is just a tab.booleanisUnderlined()Returns whether the frag is underlined.intlength()Returns the number of chars in this frag.voidsetHyphenated(boolean aFlag)Sets whether this frag has a hyphen at the end.voidstrip(int start)Strips characters after the given index from the frag.java.lang.StringtoString()Returns the frag chars as a string.-
Methods inherited from class com.reportmill.base.RMObject
clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, initWithArchiver, undoClone, undoCopy, undoEquals
-
-
-
-
Constructor Detail
-
RMTextFrag
public RMTextFrag(RMTextLine aLine)
Creates an empty text frag for a given layout and line.
-
-
Method Detail
-
getLayout
public RMTextLayout getLayout()
Returns the layout for this frag.
-
getLine
public RMTextLine getLine()
Returns the line for this frag.
-
chars
public char[] chars()
Returns the original layout char array.
-
charAt
public char charAt(int anIndex)
Returns an individual char at the given index.
-
getStart
public int getStart()
Returns the start char index for this frag.
-
getEnd
public int getEnd()
Returns the end char index for this frag.
-
length
public int length()
Returns the number of chars in this frag.
-
getX
public float getX()
Returns the x position for this frag (in the same coords as the layout frame).
-
getY
public float getY()
Returns the minY position for this frag (in the same coords as the layout frame).
-
getYBaseline
public float getYBaseline()
Returns the y position for this frag (in the same coords as the layout frame).
-
getWidth
public float getWidth()
Returns the width for this frag.
-
getHeight
public float getHeight()
Returns the height for this frag.
-
getMaxX
public float getMaxX()
Returns the maxX position for this frag (in the same coords as the layout frame).
-
getFont
public RMFont getFont()
Returns the font for this frag.
-
getColor
public RMColor getColor()
Returns the color for this frag.
-
isFontChanged
public boolean isFontChanged()
Returns whether the font for this frag has changed from the last one.
-
isColorChanged
public boolean isColorChanged()
Returns whether the color for this frag has changed from the last one.
-
isUnderlined
public boolean isUnderlined()
Returns whether the frag is underlined.
-
getUnderlineStroke
public float getUnderlineStroke()
Returns the stroke width for the underline.
-
getUnderlineY
public float getUnderlineY()
Returns the Y position for the underline.
-
getOutline
public RMXString.Outline getOutline()
Returns whether the frag should be outline.
-
getCharSpacing
public float getCharSpacing()
Returns the frag's char spacing.
-
getHyphenated
public boolean getHyphenated()
Returns whether this frag has a hyphen at the end.
-
setHyphenated
public void setHyphenated(boolean aFlag)
Sets whether this frag has a hyphen at the end.
-
strip
public void strip(int start)
Strips characters after the given index from the frag.
-
getXForChar
public float getXForChar(int charpos)
Returns the x position of the given character index.
-
getCharForX
public int getCharForX(float xOrigin)
Returns the character for the given x position.
-
isTab
public boolean isTab()
Returns whether frag is just a tab.
-
getTab
public float getTab()
Returns the tab location if this frag is a tab.
-
getTabType
public char getTabType()
Returns tab type if this frag is a tab.
-
glyphVector
public java.awt.font.GlyphVector glyphVector(java.awt.Graphics2D g)
Returns the glyph vector for the frag.
-
toString
public java.lang.String toString()
Returns the frag chars as a string.- Overrides:
toStringin classjava.lang.Object
-
-