sub_arctic.output
Class simple_text_renderer

java.lang.Object
  |
  +--sub_arctic.output.simple_text_renderer
Direct Known Subclasses:
gradient_text_renderer, shadowed_text_renderer, stipple_text_renderer

public class simple_text_renderer
extends java.lang.Object
implements text_renderer

Object for simple drawing of text in a given font and color (both of which are retained by the object).


Field Summary
protected  java.awt.Color _draw_color
          Color that text gets drawn in
protected  java.awt.Font _draw_font
          Font that text gets drawn in
protected  java.awt.FontMetrics _metrics
          Cache of font metrics object for the current font.
 
Constructor Summary
simple_text_renderer(java.awt.Font in_font, java.awt.Color in_color)
          Construct a renderer given a Font and a color to draw the text in.
 
Method Summary
 int baseline()
          The baseline location associated with this renderer.
 java.awt.Color draw_color()
          Color that text gets drawn in
 java.awt.Font draw_font()
          Font that text gets drawn in.
 void draw_text(drawable on_surface, int at_x, int at_y, java.lang.String txt)
          Render text onto the given drawable object at the given location.
 int h(java.lang.String txt)
          Height that the image of a given string drawn would take up.
 int leading()
          The amount of spacing to be placed between lines of text rendered with this renderer.
 void set_draw_color(java.awt.Color clr)
          Set the color that text gets drawn in.
 void set_draw_font(java.awt.Font fnt)
          Set the font that text gets drawn in.
 int w(java.lang.String txt)
          Width that the image of a given string drawn would take up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_draw_font

protected java.awt.Font _draw_font
Font that text gets drawn in

_metrics

protected java.awt.FontMetrics _metrics
Cache of font metrics object for the current font.

_draw_color

protected java.awt.Color _draw_color
Color that text gets drawn in
Constructor Detail

simple_text_renderer

public simple_text_renderer(java.awt.Font in_font,
                            java.awt.Color in_color)
Construct a renderer given a Font and a color to draw the text in.
Parameters:
Font - in_font font that this renderer uses.
Color - in_color color that this renderer uses.
Method Detail

draw_font

public java.awt.Font draw_font()
Font that text gets drawn in.
Returns:
Font the font used by this renderer.

set_draw_font

public void set_draw_font(java.awt.Font fnt)
Set the font that text gets drawn in.
Parameters:
Font - fnt the new font to draw in.

draw_color

public java.awt.Color draw_color()
Color that text gets drawn in
Returns:
Color the color used to draw with.

set_draw_color

public void set_draw_color(java.awt.Color clr)
Set the color that text gets drawn in.
Parameters:
Color - clr the new color to draw with.

draw_text

public void draw_text(drawable on_surface,
                      int at_x,
                      int at_y,
                      java.lang.String txt)
Render text onto the given drawable object at the given location.
Specified by:
draw_text in interface text_renderer
Parameters:
drawable - on_surface the drawing surface where we draw the result.
int - at_x x coordinate to draw at.
int - at_y y coordinate to draw at.
String - txt the text to draw.

w

public int w(java.lang.String txt)
Width that the image of a given string drawn would take up.
Specified by:
w in interface text_renderer
Parameters:
String - txt the string that will be drawn.
Returns:
int the width of the resulting image.

h

public int h(java.lang.String txt)
Height that the image of a given string drawn would take up.
Specified by:
h in interface text_renderer
Parameters:
String - txt the string that will be drawn.
Returns:
int the height of the resulting image.

baseline

public int baseline()
The baseline location associated with this renderer. This is the offset from the top of the image that the text baseline will appear at.
Specified by:
baseline in interface text_renderer
Returns:
int the baseline value.

leading

public int leading()
The amount of spacing to be placed between lines of text rendered with this renderer.
Specified by:
leading in interface text_renderer
Returns:
int the leading (vertical spacing) value.