jfig.utils
Class LP2.CharBox

java.lang.Object
  extended byjfig.utils.LP2.Box
      extended byjfig.utils.LP2.CharBox
Enclosing class:
LP2

public class LP2.CharBox
extends LP2.Box

a CharBox that holds a single character or a string of characters of the specified font.


Field Summary
protected  int colorIndex
           
protected  int fontIndex
           
protected  int ptSize
           
protected  java.lang.String s
           
protected  int y_offset
           
 
Fields inherited from class jfig.utils.LP2.Box
a, comment, d, next, parent, prev, w, x, y
 
Constructor Summary
LP2.CharBox(java.lang.String s, int fontIndex, int ptSize, int colorIndex)
           
 
Method Summary
 void append(LP2.Box child)
          append another box to this CharBox.
 void convertToFig(FigCompound parent)
          construct a FIG object from this Box and all its child boxes and put those as members into the specified FigCompound group object.
 int getColorIndex()
           
 int getFontIndex()
           
 int getPtSize()
           
 java.lang.String getText()
           
 void measure()
          measures our string "s" and updates w,a,d.
 void setText(java.lang.String s)
           
 void setYOffset(int dy)
          set an y-offset for this CharBox with respect to its baseline and origin/abutment points.
 java.lang.String toString()
           
 
Methods inherited from class jfig.utils.LP2.Box
dump, getA, getAbutmentPoint, getBounds, getComment, getD, getFigRectangle, getNextBox, getOrigin, getParent, getPrevBox, getW, getX, getY, move, moveTo, setA, setComment, setD, setNextBox, setOrigin, setParent, setPrevBox, setW, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

y_offset

protected int y_offset

fontIndex

protected int fontIndex

ptSize

protected int ptSize

colorIndex

protected int colorIndex

s

protected java.lang.String s
Constructor Detail

LP2.CharBox

public LP2.CharBox(java.lang.String s,
                   int fontIndex,
                   int ptSize,
                   int colorIndex)
Method Detail

getColorIndex

public int getColorIndex()

getFontIndex

public int getFontIndex()

getPtSize

public int getPtSize()

getText

public java.lang.String getText()

setText

public void setText(java.lang.String s)

setYOffset

public void setYOffset(int dy)
set an y-offset for this CharBox with respect to its baseline and origin/abutment points. Note that negative values move the charactor to the bottom.


measure

public void measure()
measures our string "s" and updates w,a,d. Internally, we use a Graphics2D FontRenderContext and a newly created GlyphVector to retrieve the actual bounding box of the characters in this CharBox.

Overrides:
measure in class LP2.Box

append

public void append(LP2.Box child)
append another box to this CharBox. NOTE: this method is currently never called, because the magic concatenation of boxes happens inside of GroupBox.appendMember().

Overrides:
append in class LP2.Box

toString

public java.lang.String toString()
Overrides:
toString in class LP2.Box

convertToFig

public void convertToFig(FigCompound parent)
Description copied from class: LP2.Box
construct a FIG object from this Box and all its child boxes and put those as members into the specified FigCompound group object. Check the display_boxes flag to decide whether to generate bounding boxes, too.

Overrides:
convertToFig in class LP2.Box