sprite_font class
#include <bn_sprite_font.h>
Contains the required information to generate text sprites.
Contents
Currently, it supports 4 bits per pixel (16 colors) fixed width AND variable width characters.
Also, UTF-8 characters are supported.
UTF-8 characters 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 a 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 span<const string_ view>& utf8_characters_ref) constexpr - Constructor.
-
sprite_font(const sprite_
item& item, const span<const string_ view>& utf8_characters_ref, const span<const int8_t>& character_widths_ref) constexpr - Constructor.
-
sprite_font(const sprite_
item& item, const span<const string_ view>& 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 span<const string_
view>& constexpr - Returns the reference to the list of supported UTF-8 characters.
- 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 span<const string_ view>& utf8_characters_ref) constexpr
Constructor.
| Parameters | |
|---|---|
| item | sprite_ |
| utf8_characters_ref | Reference to a list of supported UTF-8 characters. |
They should appear in the tile sets referenced by item just after ASCII characters.
UTF-8 characters are not copied but referenced, so they should outlive the sprite_
bn:: sprite_font:: sprite_font(const sprite_ item& item,
const span<const string_ view>& utf8_characters_ref,
const span<const int8_t>& character_widths_ref) constexpr
Constructor.
| Parameters | |
|---|---|
| item | sprite_ |
| utf8_characters_ref | Reference to a list of supported UTF-8 characters. |
| character_widths_ref | Reference to the width in pixels of each supported character. |
They should appear in the tile sets referenced by item just after ASCII characters.
UTF-8 characters are not copied but referenced, so they 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 span<const string_ view>& 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 a list of supported UTF-8 characters. |
| 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). |
They should appear in the tile sets referenced by item just after ASCII characters.
UTF-8 characters are not copied but referenced, so they should outlive the sprite_
Character widths are not copied but referenced, so they should outlive the sprite_
const span<const string_ view>& bn:: sprite_font:: utf8_characters_ref() const constexpr
Returns the reference to the list of supported UTF-8 characters.
They should appear in the tile sets referenced by item just after ASCII characters.
UTF-8 characters are not copied but referenced, so they 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_