Public Member Functions
-
voiddrawString (const std::string &str, const vec2 &baseline, const DrawOptions &options=DrawOptions())
Draws string str at baseline baseline with DrawOptions options .
-
voiddrawString (const std::string &str, const Rectf &fitRect, const vec2 &offset=vec2(), const DrawOptions &options=DrawOptions())
Draws string str fit inside fitRect vertically, with internal offset offset and DrawOptions options .
-
voiddrawStringWrapped (const std::string &str, const Rectf &fitRect, const vec2 &offset=vec2(), const DrawOptions &options=DrawOptions())
Draws word-wrapped string str fit inside fitRect , with internal offset offset and DrawOptions options . Mac & iOS only.
-
voiddrawGlyphs (const std::vector< std::pair< Font::Glyph, vec2 > > &glyphMeasures, const vec2 &baseline, const DrawOptions &options=DrawOptions(), const std::vector< ColorA8u > &colors=std::vector< ColorA8u >())
Draws the glyphs in glyphMeasures at baseline baseline with DrawOptions options . glyphMeasures is a vector of pairs of glyph indices and offsets for the glyph baselines.
-
voiddrawGlyphs (const std::vector< std::pair< Font::Glyph, vec2 > > &glyphMeasures, const Rectf &clip, vec2 offset, const DrawOptions &options=DrawOptions(), const std::vector< ColorA8u > &colors=std::vector< ColorA8u >())
Draws the glyphs in glyphMeasures clipped by clip , with offset added to each of the glyph offsets with DrawOptions options . glyphMeasures is a vector of pairs of glyph indices and offsets for the glyph baselines.
-
vec2measureString (const std::string &str, const DrawOptions &options=DrawOptions()) const
Returns the size in pixels necessary to render the string str with DrawOptions options .
-
vec2measureStringWrapped (const std::string &str, const Rectf &fitRect, const DrawOptions &options=DrawOptions()) const
Returns the size in pixels necessary to render the word-wrapped string str fit inside fitRect with DrawOptions options . Mac & iOS only.
-
std::vector< std::pair< Font::Glyph, vec2 > >getGlyphPlacements (const std::string &str, const DrawOptions &options=DrawOptions()) const
Returns a vector of glyph/placement pairs representing str , suitable for use with drawGlyphs. Useful for caching placement and optimizing batching.
-
std::vector< std::pair< Font::Glyph, vec2 > >getGlyphPlacements (const std::string &str, const Rectf &fitRect, const DrawOptions &options=DrawOptions()) const
Returns a vector of glyph/placement pairs representing str fit inside fitRect , suitable for use with drawGlyphs. Useful for caching placement and optimizing batching.
-
std::vector< std::pair< Font::Glyph, vec2 > >getGlyphPlacementsWrapped (const std::string &str, const Rectf &fitRect, const DrawOptions &options=DrawOptions()) const
Returns a word-wrapped vector of glyph/placement pairs representing str fit inside fitRect , suitable for use with drawGlyphs. Useful for caching placement and optimizing batching. Mac & iOS only.
-
const Font &getFont () const
Returns the font the TextureFont represents.
-
std::stringgetName () const
Returns the name of the font.
-
floatgetAscent () const
Returns the ascent of the font.
-
floatgetDescent () const
Returns the descent of the font.
-
boolisPremultiplied () const
Returns whether the TextureFont output premultipled output. Default is
false
. -
const std::unordered_map< Font::Glyph, GlyphInfo > &getGlyphMap () const
Returns the current set of characters along with its location into the set of textures.
-
const std::vector< gl::TextureRef > &getTextures () const
Returns the vector of gl::TextureRef corresponding to each page of the atlas.
Static Public Member Functions
-
create (const Font &font, const Format &format=Format(), const std::string &supportedChars=TextureFont::defaultChars())
Creates a new TextureFontRef with font font , ensuring that glyphs necessary to render supportedChars are renderable, and format format .
-
std::stringdefaultChars ()
Returns the default set of characters for a TextureFont , suitable for most English text, including some common ligatures and accented vowels.
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890().?!,:;'\"&*=+-/\#_
[]<>%^llflfiphrids����"
Protected Member Functions
Protected Attributes
-
std::unordered_map< Font::Glyph, GlyphInfo >mGlyphMap
-
std::vector< gl::TextureRef >mTextures
-
mFont
-
mFormat