org.newdawn.slick
Class TrueTypeFont

java.lang.Object
  extended by org.newdawn.slick.TrueTypeFont
All Implemented Interfaces:
Font

public class TrueTypeFont
extends java.lang.Object
implements Font

A TrueType font implementation for Slick

Author:
James Chambers (Jimmy), Jeremy Adams (elias4444), Kevin Glass (kevglass), Peter Korzuszek (genail)

Constructor Summary
TrueTypeFont(java.awt.Font font, boolean antiAlias)
          Constructor for the TrueTypeFont class Pass in the preloaded standard Java TrueType font, and whether you want it to be cached with AntiAliasing applied.
TrueTypeFont(java.awt.Font font, boolean antiAlias, char[] additionalChars)
          Constructor for the TrueTypeFont class Pass in the preloaded standard Java TrueType font, and whether you want it to be cached with AntiAliasing applied.
 
Method Summary
 void drawString(float x, float y, java.lang.String whatchars)
          Draw a string
 void drawString(float x, float y, java.lang.String whatchars, Color color)
          Draw a string
 void drawString(float x, float y, java.lang.String whatchars, Color color, int startIndex, int endIndex)
          Draw part of a string to the screen.
 int getHeight()
          Get the font's height
 int getHeight(java.lang.String HeightString)
          Get the height of a String
 int getLineHeight()
          Get the font's line height
 int getWidth(java.lang.String whatchars)
          Get the width of a given String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrueTypeFont

public TrueTypeFont(java.awt.Font font,
                    boolean antiAlias,
                    char[] additionalChars)
Constructor for the TrueTypeFont class Pass in the preloaded standard Java TrueType font, and whether you want it to be cached with AntiAliasing applied.

Parameters:
font - Standard Java AWT font
antiAlias - Whether or not to apply AntiAliasing to the cached font
additionalChars - Characters of font that will be used in addition of first 256 (by unicode).

TrueTypeFont

public TrueTypeFont(java.awt.Font font,
                    boolean antiAlias)
Constructor for the TrueTypeFont class Pass in the preloaded standard Java TrueType font, and whether you want it to be cached with AntiAliasing applied.

Parameters:
font - Standard Java AWT font
antiAlias - Whether or not to apply AntiAliasing to the cached font
Method Detail

getWidth

public int getWidth(java.lang.String whatchars)
Get the width of a given String

Specified by:
getWidth in interface Font
Parameters:
whatchars - The characters to get the width of
Returns:
The width of the characters

getHeight

public int getHeight()
Get the font's height

Returns:
The height of the font

getHeight

public int getHeight(java.lang.String HeightString)
Get the height of a String

Specified by:
getHeight in interface Font
Parameters:
HeightString - The string to obtain the rendered with of
Returns:
The height of a given string

getLineHeight

public int getLineHeight()
Get the font's line height

Specified by:
getLineHeight in interface Font
Returns:
The line height of the font

drawString

public void drawString(float x,
                       float y,
                       java.lang.String whatchars,
                       Color color)
Draw a string

Specified by:
drawString in interface Font
Parameters:
x - The x position to draw the string
y - The y position to draw the string
whatchars - The string to draw
color - The color to draw the text

drawString

public void drawString(float x,
                       float y,
                       java.lang.String whatchars,
                       Color color,
                       int startIndex,
                       int endIndex)
Description copied from interface: Font
Draw part of a string to the screen. Note that this will still position the text as though it's part of the bigger string.

Specified by:
drawString in interface Font
Parameters:
x - The x location at which to draw the string
y - The y location at which to draw the string
whatchars - The text to be displayed
color - The colour to draw with
startIndex - The index of the first character to draw
endIndex - The index of the last character from the string to draw
See Also:
Font.drawString(float, float, String, org.newdawn.slick.Color, int, int)

drawString

public void drawString(float x,
                       float y,
                       java.lang.String whatchars)
Draw a string

Specified by:
drawString in interface Font
Parameters:
x - The x position to draw the string
y - The y position to draw the string
whatchars - The string to draw


Copyright © 2006 New Dawn Software. All Rights Reserved.