Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.newdawn.slick
Class AngelCodeFont

    java.lang.Object
      org.newdawn.slick.AngelCodeFont

All Implemented Interfaces:
  Font

    public class AngelCodeFont

extends java.lang.Object
implements Font

A font implementation that will parse BMFont format font files. The font files can be output by Hiero, which is included with Slick, and also the AngelCode font tool available at: http://www.angelcode.com/products/bmfont/ This implementation copes with both the font display and kerning information allowing nicer looking paragraphs of text. Note that this utility only supports the text BMFont format definition file.

Author:
  kevin, Nathan Sweet

Constructor Summary
`AngelCodeFont(java.lang.String fntFile, Image image)` Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.
`AngelCodeFont(java.lang.String fntFile, Image image, boolean caching)` Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.
`AngelCodeFont(java.lang.String name, java.io.InputStream fntFile, java.io.InputStream imgFile)` Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.
`AngelCodeFont(java.lang.String name, java.io.InputStream fntFile, java.io.InputStream imgFile, boolean caching)` Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.
`AngelCodeFont(java.lang.String fntFile, java.lang.String imgFile)` Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.
`AngelCodeFont(java.lang.String fntFile, java.lang.String imgFile, boolean caching)` Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.

Method Summary
`void` | `drawString(float x, float y, java.lang.String text)` Draw a string to the screen
`void` | `drawString(float x, float y, java.lang.String text, Color col)` Draw a string to the screen
`void` | `drawString(float x, float y, java.lang.String text, Color col, int startIndex, int endIndex)` Draw part of a string to the screen.
`int` | `getHeight(java.lang.String text)` Get the height of the given string
`int` | `getLineHeight()` Get the maximum height of any line drawn by this font
`int` | `getWidth(java.lang.String text)` Get the width of the given string
`int` | `getYOffset(java.lang.String text)` Returns the distance from the y drawing location to the top most pixel of the specified text.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AngelCodeFont

    public AngelCodeFont(java.lang.String fntFile,
                         Image image)
                  throws SlickException

  Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.

  Parameters:
    `fntFile` - The location of the font defnition file
    `image` - The image to use for the font
  Throws:
    `SlickException` - Indicates a failure to load either file

### AngelCodeFont

    public AngelCodeFont(java.lang.String fntFile,
                         java.lang.String imgFile)
                  throws SlickException

  Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.

  Parameters:
    `fntFile` - The location of the font defnition file
    `imgFile` - The location of the font image
  Throws:
    `SlickException` - Indicates a failure to load either file

### AngelCodeFont

    public AngelCodeFont(java.lang.String fntFile,
                         Image image,
                         boolean caching)
                  throws SlickException

  Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.

  Parameters:
    `fntFile` - The location of the font defnition file
    `image` - The image to use for the font
    `caching` - True if this font should use display list caching
  Throws:
    `SlickException` - Indicates a failure to load either file

### AngelCodeFont

    public AngelCodeFont(java.lang.String fntFile,
                         java.lang.String imgFile,
                         boolean caching)
                  throws SlickException

  Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.

  Parameters:
    `fntFile` - The location of the font defnition file
    `imgFile` - The location of the font image
    `caching` - True if this font should use display list caching
  Throws:
    `SlickException` - Indicates a failure to load either file

### AngelCodeFont

    public AngelCodeFont(java.lang.String name,
                         java.io.InputStream fntFile,
                         java.io.InputStream imgFile)
                  throws SlickException

  Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.

  Parameters:
    `name` - The name to assign to the font image in the image store
    `fntFile` - The stream of the font defnition file
    `imgFile` - The stream of the font image
  Throws:
    `SlickException` - Indicates a failure to load either file

### AngelCodeFont

    public AngelCodeFont(java.lang.String name,
                         java.io.InputStream fntFile,
                         java.io.InputStream imgFile,
                         boolean caching)
                  throws SlickException

  Create a new font based on a font definition from AngelCode's tool and the font image generated from the tool.

  Parameters:
    `name` - The name to assign to the font image in the image store
    `fntFile` - The stream of the font defnition file
    `imgFile` - The stream of the font image
    `caching` - True if this font should use display list caching
  Throws:
    `SlickException` - Indicates a failure to load either file

Method Detail

### drawString

    public void drawString(float x,
                           float y,
                           java.lang.String text)

  Description copied from interface: `Font`
  Draw a string to the screen

  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
    `text` - The text to be displayed
  See Also:
    `Font.drawString(float, float, java.lang.String)`

### drawString

    public void drawString(float x,
                           float y,
                           java.lang.String text,
                           Color col)

  Description copied from interface: `Font`
  Draw a string to the screen

  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
    `text` - The text to be displayed
    `col` - The colour to draw with
  See Also:
    `Font.drawString(float, float, java.lang.String, org.newdawn.slick.Color)`

### drawString

    public void drawString(float x,
                           float y,
                           java.lang.String text,
                           Color col,
                           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
    `text` - The text to be displayed
    `col` - 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, Color, int, int)`

### getYOffset

    public int getYOffset(java.lang.String text)

  Returns the distance from the y drawing location to the top most pixel of the specified text.

  Parameters:
    `text` - The text that is to be tested
  Returns:
    The yoffset from the y draw location at which text will start

### getHeight

    public int getHeight(java.lang.String text)

  Description copied from interface: `Font`
  Get the height of the given string

  Specified by:
    `getHeight` in interface `Font`
  Parameters:
    `text` - The string to obtain the rendered with of
  Returns:
    The width of the given string
  See Also:
    `Font.getHeight(java.lang.String)`

### getWidth

    public int getWidth(java.lang.String text)

  Description copied from interface: `Font`
  Get the width of the given string

  Specified by:
    `getWidth` in interface `Font`
  Parameters:
    `text` - The string to obtain the rendered with of
  Returns:
    The width of the given string
  See Also:
    `Font.getWidth(java.lang.String)`

### getLineHeight

    public int getLineHeight()

  Description copied from interface: `Font`
  Get the maximum height of any line drawn by this font

  Specified by:
    `getLineHeight` in interface `Font`
  Returns:
    The maxium height of any line drawn by this font
  See Also:
    `Font.getLineHeight()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 New Dawn Software. All Rights Reserved.