Class 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
      char charAt​(int anIndex)
      Returns an individual char at the given index.
      char[] chars()
      Returns the original layout char array.
      int getCharForX​(float xOrigin)
      Returns the character for the given x position.
      float getCharSpacing()
      Returns the frag's char spacing.
      RMColor getColor()
      Returns the color for this frag.
      int getEnd()
      Returns the end char index for this frag.
      RMFont getFont()
      Returns the font for this frag.
      float getHeight()
      Returns the height for this frag.
      boolean getHyphenated()
      Returns whether this frag has a hyphen at the end.
      RMTextLayout getLayout()
      Returns the layout for this frag.
      RMTextLine getLine()
      Returns the line for this frag.
      float getMaxX()
      Returns the maxX position for this frag (in the same coords as the layout frame).
      RMXString.Outline getOutline()
      Returns whether the frag should be outline.
      int getStart()
      Returns the start char index for this frag.
      float getTab()
      Returns the tab location if this frag is a tab.
      char getTabType()
      Returns tab type if this frag is a tab.
      float getUnderlineStroke()
      Returns the stroke width for the underline.
      float getUnderlineY()
      Returns the Y position for the underline.
      float getWidth()
      Returns the width for this frag.
      float getX()
      Returns the x position for this frag (in the same coords as the layout frame).
      float getXForChar​(int charpos)
      Returns the x position of the given character index.
      float getY()
      Returns the minY position for this frag (in the same coords as the layout frame).
      float getYBaseline()
      Returns the y position for this frag (in the same coords as the layout frame).
      java.awt.font.GlyphVector glyphVector​(java.awt.Graphics2D g)
      Returns the glyph vector for the frag.
      boolean isColorChanged()
      Returns whether the color for this frag has changed from the last one.
      boolean isFontChanged()
      Returns whether the font for this frag has changed from the last one.
      boolean isTab()
      Returns whether frag is just a tab.
      boolean isUnderlined()
      Returns whether the frag is underlined.
      int length()
      Returns the number of chars in this frag.
      void setHyphenated​(boolean aFlag)
      Sets whether this frag has a hyphen at the end.
      void strip​(int start)
      Strips characters after the given index from the frag.
      java.lang.String toString()
      Returns the frag chars as a string.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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:
        toString in class java.lang.Object