A texture containing characters This is the SFML implementation of the gui::font. It uses sf::Font to render glyphs and get character data.
More...
#include <gui_sfml_font.hpp>
|
| font (const std::string &font_file, std::size_t size, std::size_t outline, const std::vector< code_point_range > &code_points, char32_t default_code_point) |
| Constructor.
|
|
std::size_t | get_size () const override |
| Get the size of the font in pixels.
|
|
bounds2f | get_character_uvs (char32_t c) const override |
| Returns the uv coordinates of a character on the texture.
|
|
bounds2f | get_character_bounds (char32_t c) const override |
| Returns the rect coordinates of a character as it should be drawn relative to the baseline.
|
|
float | get_character_width (char32_t c) const override |
| Returns the width of a character in pixels.
|
|
float | get_character_height (char32_t c) const override |
| Returns the height of a character in pixels.
|
|
float | get_character_kerning (char32_t c1, char32_t c2) const override |
| Return the kerning amount between two characters.
|
|
std::weak_ptr< gui::material > | get_texture () const override |
| Returns the underlying material to use for rendering.
|
|
void | update_texture (std::shared_ptr< gui::material > mat) override |
| Update the material to use for rendering.
|
|
A texture containing characters This is the SFML implementation of the gui::font. It uses sf::Font to render glyphs and get character data.
Definition at line 18 of file gui_sfml_font.hpp.
◆ font()
lxgui::gui::sfml::font::font |
( |
const std::string & |
font_file, |
|
|
std::size_t |
size, |
|
|
std::size_t |
outline, |
|
|
const std::vector< code_point_range > & |
code_points, |
|
|
char32_t |
default_code_point |
|
) |
| |
Constructor.
- Parameters
-
font_file | The name of the font file to read |
size | The requested size of the characters (in points) |
outline | The thickness of the outline (in points) |
code_points | The list of Unicode characters to load |
default_code_point | The character to display as fallback |
◆ get_character_bounds()
bounds2f lxgui::gui::sfml::font::get_character_bounds |
( |
char32_t |
c | ) |
const |
|
overridevirtual |
Returns the rect coordinates of a character as it should be drawn relative to the baseline.
- Parameters
-
- Returns
- The rect coordinates of this character (in pixels, relative to the baseline)
Implements lxgui::gui::font.
◆ get_character_height()
float lxgui::gui::sfml::font::get_character_height |
( |
char32_t |
c | ) |
const |
|
overridevirtual |
Returns the height of a character in pixels.
- Parameters
-
- Returns
- The height of the character in pixels.
Implements lxgui::gui::font.
◆ get_character_kerning()
float lxgui::gui::sfml::font::get_character_kerning |
( |
char32_t |
c1, |
|
|
char32_t |
c2 |
|
) |
| const |
|
overridevirtual |
Return the kerning amount between two characters.
- Parameters
-
c1 | The first unicode character |
c2 | The second unicode character |
- Returns
- The kerning amount between the two characters
- Note
- Kerning is a font rendering adjustment that makes some letters closer, for example in 'VA', there is room for the two to be closer than with 'VW'. This has no effect for fixed width fonts (like Courrier, etc).
Implements lxgui::gui::font.
◆ get_character_uvs()
bounds2f lxgui::gui::sfml::font::get_character_uvs |
( |
char32_t |
c | ) |
const |
|
overridevirtual |
Returns the uv coordinates of a character on the texture.
- Parameters
-
- Returns
- The uv coordinates of this character on the texture
- Note
- The uv coordinates are normalized, i.e. they range from 0 to 1. They are arranged as {u1, v1, u2, v2}.
Implements lxgui::gui::font.
◆ get_character_width()
float lxgui::gui::sfml::font::get_character_width |
( |
char32_t |
c | ) |
const |
|
overridevirtual |
Returns the width of a character in pixels.
- Parameters
-
- Returns
- The width of the character in pixels.
Implements lxgui::gui::font.
◆ get_size()
std::size_t lxgui::gui::sfml::font::get_size |
( |
| ) |
const |
|
overridevirtual |
Get the size of the font in pixels.
- Returns
- The size of the font in pixels
Implements lxgui::gui::font.
◆ get_texture()
std::weak_ptr< gui::material > lxgui::gui::sfml::font::get_texture |
( |
| ) |
const |
|
overridevirtual |
Returns the underlying material to use for rendering.
- Returns
- The underlying material to use for rendering
Implements lxgui::gui::font.
◆ update_texture()
void lxgui::gui::sfml::font::update_texture |
( |
std::shared_ptr< gui::material > |
mat | ) |
|
|
overridevirtual |
Update the material to use for rendering.
- Parameters
-
mat | The material to use for rendering |
Implements lxgui::gui::font.
The documentation for this class was generated from the following file: