com.flagstone.transform.util.text
Class TextTable

java.lang.Object
  extended by com.flagstone.transform.util.text.TextTable

public final class TextTable
extends Object

TextTable is used to generate test definitions for a specific (fixed) point size of a font. Each instance caches a table of GlyphIndex objects with predefined advances allowing the objects for each character used to be shared amongst the TextSpan objects that are used to display text.


Constructor Summary
TextTable(DefineFont2 font, int fontSize)
          Creates a TextTable for the specified font size.
 
Method Summary
 Bounds boundsForText(String text)
          Create a bound box that encloses the line of text when rendered using the specified font and size.
 List<GlyphIndex> charactersForText(String text)
          Create a list of characters that can be added to a text span.
 TextSpan defineSpan(String text, Color color, int xCoord, int yCoord)
          Create a span of text that can be added to a static text field.
 DefineText2 defineText(int uid, String text, Color color)
          Create a definition for a static text field that displays a single line of text in the specified font.
 DefineText2 defineTextBlock(int uid, List<String> lines, Color color, int lineSpacing)
          Create a definition for a static text field that displays a block of text in the specified font.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextTable

public TextTable(DefineFont2 font,
                 int fontSize)
Creates a TextTable for the specified font size.

Parameters:
font - the font definition.
fontSize - the size of the font in twips.
Method Detail

boundsForText

public Bounds boundsForText(String text)
Create a bound box that encloses the line of text when rendered using the specified font and size.

Parameters:
text - the string to be displayed.
Returns:
the bounding box that completely encloses the text.

charactersForText

public List<GlyphIndex> charactersForText(String text)
Create a list of characters that can be added to a text span.

Parameters:
text - the string to be displayed.
Returns:
a TextSpan object that can be added to a DefineText or DefineText2 object.

defineSpan

public TextSpan defineSpan(String text,
                           Color color,
                           int xCoord,
                           int yCoord)
Create a span of text that can be added to a static text field.

Parameters:
text - the string to be displayed.
color - the colour used to display the text.
xCoord - the x-coordinate for the origin of the text span.
yCoord - the y-coordinate for the origin of the text span.
Returns:
a TextSpan object that can be added to a DefineText or DefineText2 object.

defineText

public DefineText2 defineText(int uid,
                              String text,
                              Color color)
Create a definition for a static text field that displays a single line of text in the specified font.

Parameters:
uid - the unique identifier that will be used to reference the text field in a flash file.
text - the string to be displayed.
color - the colour used to display the text.
Returns:
a DefineText2 object that can be added to a Flash file.

defineTextBlock

public DefineText2 defineTextBlock(int uid,
                                   List<String> lines,
                                   Color color,
                                   int lineSpacing)
Create a definition for a static text field that displays a block of text in the specified font.

Parameters:
uid - the unique identifier that will be used to reference the text field in a flash file.
lines - the list of strings to be displayed.
color - the colour used to display the text.
lineSpacing - the spearation between successive lines of text.
Returns:
a DefineText2 object that can be added to a Flash file.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.