#include <StkTextureFontSDF.h>
|
bool | initTextureAtlas (int atlas_width, int atlas_height, int onedge_value, int padding) |
|
| TextureFontSDF (const std::string &font_id) |
|
int | getPadding () const |
|
bool | packCharacterRange (int codepoint) |
| Pack all characters in the same range as the given codepoint. Note that this process may be time consuming for large font sizes, so do this in a preprocess if possible.
|
|
bool | packCharacterRanges (int codepoint) |
| Pack all character ranges up to and including the given code point. Note that this process may be time consuming for large font sizes, so do this in a preprocess if possible.
|
|
int | calcMaxPackedCodepoint () const |
|
| Font (const std::string &font_id) |
|
const std::string & | getFontID () const |
|
int | getFontNumber () const |
| Return unique integer ID for this font.
|
|
bool | initFontData (const std::string &filename, int font_size, int font_idx=0) |
| Initialize font.
|
|
void | updateTexture () |
| Update the OpenGL texture. This is normally done on demand, but may also be called explicitly if you need to keep control of when this should happen.
|
|
void | clearTexture () |
| Clear OpenGL texture data. Requires a valid OpenGL context.
|
|
Font::GlyphInfo | makeGlyphInfo (uint32_t character, float &offsetX, float &offsetY) |
|
void | bindTexture () |
|
void | saveTextureAtlas (const std::string &filename="") |
|
float | getAscent () const |
| Get max distance (in pixels) above the baseline for this font.
|
|
float | getDescent () const |
| Get max distance (in pixels) below the baseline for this font.
|
|
float | getLineGap () const |
| Get spacing (in pixels) between one row's descent and the next row's ascent for this font.
|
|
float | getLineDistance () const |
| Get default distance (in pixels) between two rows in this font.
|
|
int | getPixelSize () const |
| Get font size (in pixels).
|
|
void | getAdvanceBearing (int codepoint, float &advance, float &bearing) |
| Get horizontal metrics (in pixels) for the given character. Bearing is the offset from the current horizontal position to the left edge of the character. advance is the offset from the current horizontal position to the next horizontal position.
|
|
|
static double | pointToPixelSize (double pt_size, double dpi=96) |
|
static double | pixelToPointSize (double px_size, double dpi=96) |
|
template<class T > |
void | findCharRanges (std::vector< std::unique_ptr< T > > &char_ranges, int max_cp) |
|
template<class T > |
int | calcMaxPackedCodepoint (const std::vector< std::unique_ptr< T > > &char_ranges) const |
|
virtual bool | getCharacterQuad (int codepoint, stbtt_aligned_quad &quad, float &offsetX, float &offsetY)=0 |
|
std::string | font_id_ |
|
std::string | font_filename_ |
|
int | font_num_ = 0 |
|
int | font_size_ = 0 |
|
float | font_scale_ = 0.0f |
|
int | atlas_width_ = 0 |
|
int | atlas_height_ = 0 |
|
std::unique_ptr< uint8_t[]> | atlas_data_ |
|
GLuint | texture_ = 0 |
|
bool | texture_dirty_ = false |
|
std::unique_ptr< stbtt_fontinfo > | font_info_ |
|
std::vector< uint8_t > | font_data_ |
|
int | font_idx_ = 0 |
|
static int | s_font_num_ = 1 |
|
TextureFontSDF - Short description
◆ packCharacterRange()
bool STK::TextureFontSDF::packCharacterRange |
( |
int |
codepoint | ) |
|
Pack all characters in the same range as the given codepoint. Note that this process may be time consuming for large font sizes, so do this in a preprocess if possible.
- Parameters
-
codepoint | Unicode character code |
- Returns
- true on success, false on failure
◆ packCharacterRanges()
bool STK::TextureFontSDF::packCharacterRanges |
( |
int |
codepoint | ) |
|
Pack all character ranges up to and including the given code point. Note that this process may be time consuming for large font sizes, so do this in a preprocess if possible.
- Parameters
-
codepoint | Unicode character code |
- Returns
- true on success, false on failure
The documentation for this class was generated from the following files:
- Native/SilentToolkit/StkScene/StkTextureFontSDF.h
- Native/SilentToolkit/StkScene/StkTextureFontSDF.cpp