net.rim.device.api.ui
Class TextMetrics

java.lang.Object
  extended by net.rim.device.api.ui.TextMetrics

public final class TextMetrics
extends Object

Metrics returned when drawing or measuring text.

Since:
BlackBerry API 6.0.0

Constructor Summary
TextMetrics()
          Empty constructor.
 
Method Summary
 int getAdvanceX()
          Gets the horizontal component of the change in the drawing position caused by drawing the text.
 int getAdvanceY()
          Gets the vertical component of the change in the drawing position caused by drawing the text.
 int getAscent()
          Gets the ideal ascent for the text, in pixels.
 int getBoundsBottom()
          Gets the bottom edge of the bounding box of the inked pixels of all the glyphs drawn.
 int getBoundsLeft()
          Gets the left edge of the bounding box of the inked pixels of all the glyphs drawn.
 int getBoundsRight()
          Gets the right edge of the bounding box of the inked pixels of all the glyphs drawn.
 int getBoundsTop()
          Gets the top edge of the bounding box of the inked pixels of all the glyphs drawn.
 int getDescent()
          Gets the ideal descent for the text, in pixels.
 int getNextAdvanceX()
          If not all characters could be drawn, gets the horizontal component of the advance if another character group were drawn.
 int getNextAdvanceY()
          If not all characters could be drawn, gets the vertical component of the advance if another character group were drawn.
 int getNextNumberOfCharactersDrawn()
          If not all characters could be drawn, gets the number of characters that would be drawn if another character group were drawn.
 int getNextOriginX()
          Gets the x coordinate of the position at which to start drawing the next part of the text, taking into account kerning if not all characters were drawn.
 int getNextOriginY()
          Gets the y coordinate of the position at which to start drawing the next part of the text, taking into account kerning if not all characters were drawn.
 int getNumberOfCharactersDrawn()
          Gets the number of characters drawn.
 boolean needsBidiReordering()
          Returns information about whether bidirectional reordering was needed (or actually done, if reordering was turned on).
 void reset()
          Set all metrics to their standard values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

TextMetrics

public TextMetrics()
Empty constructor.

Since:
BlackBerry API 6.0.0


Method Detail

getAdvanceX

public int getAdvanceX()
Gets the horizontal component of the change in the drawing position caused by drawing the text.

Returns:
The horizontal advance in pixels.
Since:
BlackBerry API 6.0.0

getAdvanceY

public int getAdvanceY()
Gets the vertical component of the change in the drawing position caused by drawing the text.

Returns:
The vertical advance in pixels.
Since:
BlackBerry API 6.0.0

getBoundsLeft

public int getBoundsLeft()
Gets the left edge of the bounding box of the inked pixels of all the glyphs drawn.

Returns:
The left edge of the bounds in pixels.
Since:
BlackBerry API 6.0.0

getBoundsTop

public int getBoundsTop()
Gets the top edge of the bounding box of the inked pixels of all the glyphs drawn.

Returns:
The top edge of the bounds in pixels.
Since:
BlackBerry API 6.0.0

getBoundsRight

public int getBoundsRight()
Gets the right edge of the bounding box of the inked pixels of all the glyphs drawn.

Returns:
The right edge of the bounds in pixels.
Since:
BlackBerry API 6.0.0

getBoundsBottom

public int getBoundsBottom()
Gets the bottom edge of the bounding box of the inked pixels of all the glyphs drawn.

Returns:
The bottom edge of the bounds in pixels.
Since:
BlackBerry API 6.0.0

getNumberOfCharactersDrawn

public int getNumberOfCharactersDrawn()
Gets the number of characters drawn.

Returns:
The number of characters drawn.
Since:
BlackBerry API 6.0.0

getNextAdvanceX

public int getNextAdvanceX()
If not all characters could be drawn, gets the horizontal component of the advance if another character group were drawn.

Returns:
If not all characters were drawn, the horizontal component of the total advance if another character group were drawn; otherwise the value returned by getAdvanceX.
Since:
BlackBerry API 6.0.0

getNextAdvanceY

public int getNextAdvanceY()
If not all characters could be drawn, gets the vertical component of the advance if another character group were drawn.

Returns:
If not all characters were drawn, the vertical component of the total advance if another character group were drawn; otherwise the value returned by getAdvanceY.
Since:
BlackBerry API 6.0.0

getNextNumberOfCharactersDrawn

public int getNextNumberOfCharactersDrawn()
If not all characters could be drawn, gets the number of characters that would be drawn if another character group were drawn.

Returns:
If not all characters were drawn, the number of characters that would be drawn if another character group were drawn, otherwise the value returned by getNumberOfCharactersDrawn.
Since:
BlackBerry API 6.0.0

getNextOriginX

public int getNextOriginX()
Gets the x coordinate of the position at which to start drawing the next part of the text, taking into account kerning if not all characters were drawn. If all characters were drawn the return value is the same as the value returned by getAdvanceX.

Returns:
The x coordinate of the next drawing position.
Since:
BlackBerry API 6.0.0

getNextOriginY

public int getNextOriginY()
Gets the y coordinate of the position at which to start drawing the next part of the text, taking into account kerning if not all characters were drawn. If all characters were drawn the return value is the same as the value returned by getAdvanceY.

Returns:
The y coordinate of the next drawing position.
Since:
BlackBerry API 6.0.0

needsBidiReordering

public boolean needsBidiReordering()
Returns information about whether bidirectional reordering was needed (or actually done, if reordering was turned on).

Returns:
True if bidirectional reordering was needed; false if not.
Since:
BlackBerry API 6.0.0

getAscent

public int getAscent()
Gets the ideal ascent for the text, in pixels. This is the maximum of the ideal ascents of all the glyphs. The ascent includes both the ordinary ascent and any leading above.

Returns:
The ascent in pixels.
Since:
BlackBerry API 7.0.0

getDescent

public int getDescent()
Gets the ideal descent for the text, in pixels. This is the maximum of the ideal descents of all the glyphs. The descent includes both the ordinary descent and any leading below.

Returns:
The descent in pixels.
Since:
BlackBerry API 7.0.0

reset

public void reset()
Set all metrics to their standard values.

Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal