Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::TextureFont Class Reference

#include <StkTextureFont.h>

Inheritance diagram for STK::TextureFont:
STK::Font

Public Member Functions

 TextureFont (const std::string &font_id)
 
bool beginFontPacking (int atlas_width, int atlas_height, int oversample_x, int oversample_y)
 
bool packCharacterRange (int codepoint)
 
bool packCharacterRanges (int codepoint)
 
void endFontPacking ()
 
int calcMaxPackedCodepoint () const
 
- Public Member Functions inherited from STK::Font
 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.
 

Additional Inherited Members

- Static Public Member Functions inherited from STK::Font
static double pointToPixelSize (double pt_size, double dpi=96)
 
static double pixelToPointSize (double px_size, double dpi=96)
 
- Protected Member Functions inherited from STK::Font
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
 
- Protected Attributes inherited from STK::Font
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_fontinfofont_info_
 
std::vector< uint8_t > font_data_
 
int font_idx_ = 0
 
- Static Protected Attributes inherited from STK::Font
static int s_font_num_ = 1
 

Detailed Description

TextureFont - Short description

Member Function Documentation

◆ packCharacterRange()

bool STK::TextureFont::packCharacterRange ( int  codepoint)

Pack all characters in the same range as the given codepoint.

◆ packCharacterRanges()

bool STK::TextureFont::packCharacterRanges ( int  codepoint)

Pack all character ranges up to and including the given code point.


The documentation for this class was generated from the following files: