class
#include <bn_sprite_font.h>
sprite_font Contains the required information to generate text sprites.
Currently, it supports 4 bits per pixel (16 colors) fixed width AND variable width characters.
Also, UTF-8 characters are supported.
UTF-8 characters map and character widths are not copied but referenced, so they should outlive the sprite_
Public static variables
- static int minimum_graphics constexpr
- Minimum number of sprite tile sets that must contain the sprite_
tiles_ item of a sprite_ font.
Constructors, destructors, conversion operators
-
sprite_font(const sprite_
item& item) explicit constexpr - Constructor.
-
sprite_font(const sprite_
item& item, const utf8_ characters_ map_ ref& utf8_characters_ref) constexpr - Constructor.
-
sprite_font(const sprite_
item& item, const utf8_ characters_ map_ ref& utf8_characters_ref, const span<const int8_t>& character_widths_ref) constexpr - Constructor.
-
sprite_font(const sprite_
item& item, const utf8_ characters_ map_ ref& utf8_characters_ref, const span<const int8_t>& character_widths_ref, int space_between_characters) constexpr - Constructor.
Public functions
-
auto item() const -> const sprite_
item& constexpr - Returns the sprite_
item used to generate text sprites. -
auto utf8_characters_ref() const -> const utf8_
characters_ map_ ref& constexpr - Returns the reference to the map of the supported UTF-8 characters and their position in the tile sets.
- auto character_widths_ref() const -> const span<const int8_t>& constexpr
- Returns the reference to the width in pixels of each supported character.
- auto space_between_characters() const -> int
- Returns the space between two consecutive characters in pixels (it can be negative).
Function documentation
bn:: sprite_font:: sprite_font(const sprite_ item& item) explicit constexpr
Constructor.
Parameters | |
---|---|
item | sprite_ |
bn:: sprite_font:: sprite_font(const sprite_ item& item,
const utf8_ characters_ map_ ref& utf8_characters_ref) constexpr
Constructor.
Parameters | |
---|---|
item | sprite_ |
utf8_characters_ref | Reference to the map of the supported UTF-8 characters and their position in the tile sets. |
UTF-8 characters should appear in the tile sets referenced by item just after ASCII characters.
UTF-8 characters map is not copied but referenced, so it should outlive the sprite_
bn:: sprite_font:: sprite_font(const sprite_ item& item,
const utf8_ characters_ map_ ref& utf8_characters_ref,
const span<const int8_t>& character_widths_ref) constexpr
Constructor.
Parameters | |
---|---|
item | sprite_ |
utf8_characters_ref | Reference to the map of the supported UTF-8 characters and their position in the tile sets. |
character_widths_ref | Reference to the width in pixels of each supported character. |
UTF-8 characters should appear in the tile sets referenced by item just after ASCII characters.
UTF-8 characters map is not copied but referenced, so it should outlive the sprite_
Character widths are not copied but referenced, so they should outlive the sprite_
bn:: sprite_font:: sprite_font(const sprite_ item& item,
const utf8_ characters_ map_ ref& utf8_characters_ref,
const span<const int8_t>& character_widths_ref,
int space_between_characters) constexpr
Constructor.
Parameters | |
---|---|
item | sprite_ |
utf8_characters_ref | Reference to the map of the supported UTF-8 characters and their position in the tile sets. |
character_widths_ref | Reference to the width in pixels of each supported character. |
space_between_characters | Space between two consecutive characters in pixels (it can be negative). |
UTF-8 characters should appear in the tile sets referenced by item just after ASCII characters.
UTF-8 characters map is not copied but referenced, so it should outlive the sprite_
Character widths are not copied but referenced, so they should outlive the sprite_
const utf8_ characters_ map_ ref& bn:: sprite_font:: utf8_characters_ref() const constexpr
Returns the reference to the map of the supported UTF-8 characters and their position in the tile sets.
UTF-8 characters should appear in the tile sets referenced by item just after ASCII characters.
UTF-8 characters map is not copied but referenced, so it should outlive the sprite_
const span<const int8_t>& bn:: sprite_font:: character_widths_ref() const constexpr
Returns the reference to the width in pixels of each supported character.
Character widths are not copied but referenced, so they should outlive the sprite_