edu.neu.ccs.gui
Interface TextAnchor.Locator

Enclosing interface:
TextAnchor

public static interface TextAnchor.Locator

The Locator interface defines the methods needed to compute the coordinates, bounds, and center of a String displayed in a given Font using the given anchor positions and this strategy.


Method Summary
 float getAscentLineY(String string, Font font, float anchorY)
          Returns the ascent line y-coordinate of the string.
 float getBaseLineY(String string, Font font, float anchorY)
          Returns the base line y-coordinate of the string.
 XRect getBounds2D(String string, Font font, float anchorX, float anchorY)
          Returns a copy of the 2-dimensional bounds of the area that will be occupied by the displayed string.
 XPoint2D getCenter(String string, Font font, float anchorX, float anchorY)
          Returns a copy of the logical center of the displayed string, that is, the point specified by getCenterX and by getBaseLineY.
 float getCenterX(String string, Font font, float anchorX)
          Returns the center x-coordinate of the string.
 float getDescentLineY(String string, Font font, float anchorY)
          Returns the descent line y-coordinate of the string.
 float getHeight(String string, Font font, float anchorY)
          Returns the height of the area that will be occupied by the displayed string.
 float getLeadingLineY(String string, Font font, float anchorY)
          Returns the leading line y-coordinate of the string.
 float getLeftX(String string, Font font, float anchorX)
          Returns the left x-coordinate of the string.
 float getRightX(String string, Font font, float anchorX)
          Returns the right x-coordinate of the string.
 float getWidth(String string, Font font, float anchorX)
          Returns the width of the area that will be occupied by the displayed string.
 

Method Detail

getLeftX

public float getLeftX(String string,
                      Font font,
                      float anchorX)
Returns the left x-coordinate of the string.

Parameters:
string - the string to display
font - the font to use for the display
anchorX - the x-coordinate of the anchor position
Returns:
the left x-coordinate of the string

getRightX

public float getRightX(String string,
                       Font font,
                       float anchorX)
Returns the right x-coordinate of the string.

Parameters:
string - the string to display
font - the font to use for the display
anchorX - the x-coordinate of the anchor position
Returns:
the right x-coordinate of the string

getCenterX

public float getCenterX(String string,
                        Font font,
                        float anchorX)
Returns the center x-coordinate of the string.

Parameters:
string - the string to display
font - the font to use for the display
anchorX - the x-coordinate of the anchor position
Returns:
the center x-coordinate of the string

getBaseLineY

public float getBaseLineY(String string,
                          Font font,
                          float anchorY)
Returns the base line y-coordinate of the string.

Parameters:
string - the string to display
font - the font to use for the display
anchorY - the y-coordinate of the anchor position
Returns:
the base line y-coordinate of the string

getAscentLineY

public float getAscentLineY(String string,
                            Font font,
                            float anchorY)
Returns the ascent line y-coordinate of the string.

Parameters:
string - the string to display
font - the font to use for the display
anchorY - the y-coordinate of the anchor position
Returns:
the ascent line y-coordinate of the string

getDescentLineY

public float getDescentLineY(String string,
                             Font font,
                             float anchorY)
Returns the descent line y-coordinate of the string.

Parameters:
string - the string to display
font - the font to use for the display
anchorY - the y-coordinate of the anchor position
Returns:
the descent line y-coordinate of the string

getLeadingLineY

public float getLeadingLineY(String string,
                             Font font,
                             float anchorY)
Returns the leading line y-coordinate of the string.

Parameters:
string - the string to display
font - the font to use for the display
anchorY - the y-coordinate of the anchor position
Returns:
the leading line y-coordinate of the string

getWidth

public float getWidth(String string,
                      Font font,
                      float anchorX)

Returns the width of the area that will be occupied by the displayed string.

Parameters:
string - the string to display
font - the font to use for the display
anchorX - the x-coordinate of the anchor position
Returns:
the width of the displayed string

getHeight

public float getHeight(String string,
                       Font font,
                       float anchorY)

Returns the height of the area that will be occupied by the displayed string.

Parameters:
string - the string to display
font - the font to use for the display
anchorY - the y-coordinate of the anchor position
Returns:
the height of the displayed string

getBounds2D

public XRect getBounds2D(String string,
                         Font font,
                         float anchorX,
                         float anchorY)

Returns a copy of the 2-dimensional bounds of the area that will be occupied by the displayed string.

Parameters:
string - the string to display
font - the font to use for the display
anchorX - the x-coordinate of the anchor position
anchorY - the y-coordinate of the anchor position
Returns:
the 2-dimensional bounds of the displayed string

getCenter

public XPoint2D getCenter(String string,
                          Font font,
                          float anchorX,
                          float anchorY)

Returns a copy of the logical center of the displayed string, that is, the point specified by getCenterX and by getBaseLineY.

Parameters:
string - the string to display
font - the font to use for the display
anchorX - the x-coordinate of the anchor position
anchorY - the y-coordinate of the anchor position
Returns:
the 2-dimensional bounds of the displayed string