BitmapFontAtlas
in package
Table of Contents
Properties
- $textureHeight : int
- The font atlas texture height.
- $texturePath : null|string
- The font atlas texture path on disk.
- $textureWidth : int
- The font atlas texture width.
- $characters : array<int, BitmapFontCharacter>
- The font atlas characters.
Methods
- __construct() : mixed
- Constructor
- getCharacter() : BitmapFontCharacter|null
- Returns a character from the font atlas for the given codepoint.
- getCharacterForC() : BitmapFontCharacter|null
- Returns a character from the font atlas for the given string character.
- getCharactersForString() : array<string|int, BitmapFontCharacter>
- Returns an array of characters from the font atlas for the given string.
- setCharacter() : void
- Adds a character to the font atlas.
- setCharacterForC() : void
- Sets a character for the given string character.
Properties
$textureHeight read-only
The font atlas texture height.
public
int
$textureHeight
$texturePath read-only
The font atlas texture path on disk.
public
null|string
$texturePath
This is optional as you might wont to generate the texture at runtime in memory..
$textureWidth read-only
The font atlas texture width.
public
int
$textureWidth
$characters
The font atlas characters.
private
array<int, BitmapFontCharacter>
$characters
= []
character are indexed by their unicode codepoint.
Methods
__construct()
Constructor
public
__construct(int $textureWidth, int $textureHeight, string|null $texturePath[, array<int, BitmapFontCharacter> $characters = [] ]) : mixed
Parameters
- $textureWidth : int
-
The font atlas texture width.
- $textureHeight : int
-
The font atlas texture height.
- $texturePath : string|null
-
The font atlas texture path on disk.
- $characters : array<int, BitmapFontCharacter> = []
-
The font atlas characters.
getCharacter()
Returns a character from the font atlas for the given codepoint.
public
getCharacter(int $codepoint) : BitmapFontCharacter|null
Parameters
- $codepoint : int
-
The unicode codepoint of the character.
Return values
BitmapFontCharacter|null —The character or null if it does not exist.
getCharacterForC()
Returns a character from the font atlas for the given string character.
public
getCharacterForC(string $character) : BitmapFontCharacter|null
Parameters
- $character : string
-
The character.
Return values
BitmapFontCharacter|null —The character or null if it does not exist.
getCharactersForString()
Returns an array of characters from the font atlas for the given string.
public
getCharactersForString(string $string) : array<string|int, BitmapFontCharacter>
Parameters
- $string : string
-
The string.
Return values
array<string|int, BitmapFontCharacter> —The characters.
setCharacter()
Adds a character to the font atlas.
public
setCharacter(int $codepoint, BitmapFontCharacter $character) : void
Parameters
- $codepoint : int
-
The character codepoint.
- $character : BitmapFontCharacter
-
The character to add.
setCharacterForC()
Sets a character for the given string character.
public
setCharacterForC(string $char, BitmapFontCharacter $character) : void
Parameters
- $char : string
-
The character to add.
- $character : BitmapFontCharacter
-
The character to add.