uavsim.graphics.text
Class VectorTextCharacterSet

java.lang.Object
  extended by uavsim.graphics.text.VectorTextCharacterSet

public class VectorTextCharacterSet
extends java.lang.Object

Defines the vector character set for rending scalable vector graphics of text strings.

Author:
Dan Tappan [10.04.11]

Field Summary
(package private) static int CHAR_MAX
          the highest supported ASCII character
(package private) static int CHAR_MIN
          the lowest supported ASCII character
(package private) static int[][][] CHAR_SET
          the vector character set, where each character is represented as a series of vector lines in a 5x9 grid.
(package private) static int CHAR_UNDEFINED
          the character code for an undefined mapping
(package private) static int MATRIX_HEIGHT_WITH_DESCENDERS
          the height of the vector matrix for characters with descenders
(package private) static int MATRIX_HEIGHT_WITHOUT_DESCENDERS
          the height of the vector matrix for characters without descenders
(package private) static int MATRIX_WIDTH
          the width of the vector matrix
(package private) static int X1
          the array index of x start for a line segment
(package private) static int X2
          the array index of x end for a line segment
(package private) static int Y1
          the array index of y start for a line segment
(package private) static int Y2
          the array index of y end for a line segment
 
Constructor Summary
VectorTextCharacterSet()
           
 
Method Summary
(package private) static int getCharacterIndex(char textChar)
          Maps a character to its representation in the vector array.
static int getMatrixHeight(boolean areDescendersIgnored)
          Gets the base height of all characters without considering any scaling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHAR_MAX

static final int CHAR_MAX
the highest supported ASCII character

See Also:
Constant Field Values

CHAR_MIN

static final int CHAR_MIN
the lowest supported ASCII character

See Also:
Constant Field Values

CHAR_SET

static final int[][][] CHAR_SET
the vector character set, where each character is represented as a series of vector lines in a 5x9 grid. The top 5x7 is used for normal characters, and the last two rows are for lowercase descenders. The array indexing is [CHAR_NUM][VECTOR_NUM]->{X1,Y1,X2,Y2}. The number before the colon is the array position; the number after it is the ASCII value of the character. Characters below ASCII 32 have no printable representation. New characters must be added at the end of the character set and require constant CHAR_MAX to be updated. The vector paths must be listed in connecting order unless they are noncontiguous


CHAR_UNDEFINED

static final int CHAR_UNDEFINED
the character code for an undefined mapping

See Also:
Constant Field Values

MATRIX_HEIGHT_WITH_DESCENDERS

static final int MATRIX_HEIGHT_WITH_DESCENDERS
the height of the vector matrix for characters with descenders

See Also:
Constant Field Values

MATRIX_HEIGHT_WITHOUT_DESCENDERS

static final int MATRIX_HEIGHT_WITHOUT_DESCENDERS
the height of the vector matrix for characters without descenders

See Also:
Constant Field Values

MATRIX_WIDTH

static final int MATRIX_WIDTH
the width of the vector matrix

See Also:
Constant Field Values

X1

static final int X1
the array index of x start for a line segment

See Also:
Constant Field Values

X2

static final int X2
the array index of x end for a line segment

See Also:
Constant Field Values

Y1

static final int Y1
the array index of y start for a line segment

See Also:
Constant Field Values

Y2

static final int Y2
the array index of y end for a line segment

See Also:
Constant Field Values
Constructor Detail

VectorTextCharacterSet

public VectorTextCharacterSet()
Method Detail

getCharacterIndex

static int getCharacterIndex(char textChar)
Maps a character to its representation in the vector array.

Parameters:
textChar - - the character
Returns:
the index, or CHAR_UNDEFINED if textChar is not supported

getMatrixHeight

public static int getMatrixHeight(boolean areDescendersIgnored)
Gets the base height of all characters without considering any scaling. The return value is either MATRIX_HEIGHT_WITH_DESCENDERS or MATRIX_HEIGHT_WITHOUT_DESCENDERS.

Parameters:
areDescendersIgnored - - whether to consider descenders as part of the height. Purely uppercase characters may align better in certain cases (like with a background) when descenders are ignored
Returns:
the height