Class TSimpleTextureFont
Unit
CastleFonts
Declaration
type TSimpleTextureFont = class(TCastleFont)
Description
2D font using a texture to define character images with constant width and height.
This class has some assumptions about how the font image looks like: the characters are drawn in ASCII order, starting from space, on an image. Derive your own descendants of TCastleFont to have more flexibility, see the implementation of this class — it is quite simple. Or use TTextureFont that can read data from a FreeType (like ttf) font file.
See e.g. castle_game_engine/examples/fonts/data/sonic_asalga_0.png how to prepare an image for use with such font. You can find more such fonts on the Internet, see e.g. http://opengameart.org/content/sonic-font and http://opengameart.org/content/null-terminator.
Hierarchy
Overview
Methods
Description
Methods
 |
constructor Create(AImage: TCastleImage; const AImageCols, AImageRows, ACharMargin, ACharDisplayMargin: Integer); |
Load font from given image.
Parameters
- AImage
- Image data, becomes owned by this class.
- ACharMargin
- There is a margin in the image between rows and cols.
- ACharDisplayMargin
- We can display some spacing between characters. This is independent from CharMargin and image contents.
|
 |
destructor Destroy; override; |
|
 |
procedure GLContextOpen; override; |
|
 |
procedure GLContextClose; override; |
|
 |
procedure Print(const X, Y: Integer; const Color: TCastleColor; const S: string); override; |
|
 |
function TextWidth(const S: string): Integer; override; |
|
 |
function TextHeight(const S: string): Integer; override; |
|
 |
function TextHeightBase(const S: string): Integer; override; |
|
Generated by PasDoc 0.14.0.
|