#include <TextureFont.h>
Classes | |
struct | DrawOptions |
class | Format |
struct | GlyphInfo |
Public Member Functions | |
void | drawString (const std::string &str, const Vec2f &baseline, const DrawOptions &options=DrawOptions()) |
Draws string str at baseline baseline with DrawOptions options. | |
void | drawString (const std::string &str, const Rectf &fitRect, const Vec2f &offset=Vec2f::zero(), const DrawOptions &options=DrawOptions()) |
Draws string str fit inside fitRect, with internal offset offset and DrawOptions options. | |
void | drawStringWrapped (const std::string &str, const Rectf &fitRect, const Vec2f &offset=Vec2f::zero(), const DrawOptions &options=DrawOptions()) |
Draws word-wrapped string str fit inside fitRect, with internal offset offset and DrawOptions options. Mac & iOS only. | |
void | drawGlyphs (const std::vector< std::pair< uint16_t, Vec2f > > &glyphMeasures, const Vec2f &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. | |
void | drawGlyphs (const std::vector< std::pair< uint16_t, Vec2f > > &glyphMeasures, const Rectf &clip, Vec2f 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. | |
Vec2f | measureString (const std::string &str, const DrawOptions &options=DrawOptions()) const |
Returns the size in pixels necessary to render the string str with DrawOptions options. | |
Vec2f | measureStringWrapped (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 < uint16_t, Vec2f > > | getGlyphPlacements (const std::string &str, const DrawOptions &options) 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 < uint16_t, Vec2f > > | getGlyphPlacements (const std::string &str, const Rectf &fitRect, const DrawOptions &options) 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. | |
const Font & | getFont () const |
Returns the font the TextureFont represents. | |
std::string | getName () const |
Returns the name of the font. | |
float | getAscent () const |
Returns the ascent of the font. | |
float | getDescent () const |
Returns the descent of the font. | |
bool | isPremultiplied () const |
Returns whether the TextureFont output premultipled output. Default is false . | |
Static Public Member Functions | |
static TextureFontRef | 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. | |
static std::string | defaultChars () |
Protected Member Functions | |
TextureFont (const Font &font, const std::string &supportedChars, const Format &format) | |
Protected Attributes | |
boost::unordered_map < Font::Glyph, GlyphInfo > | mGlyphMap |
std::vector< gl::Texture > | mTextures |
Font | mFont |
Format | mFormat |
cinder::gl::TextureFont::TextureFont | ( | const Font & | font, |
const std::string & | supportedChars, | ||
const Format & | format | ||
) | [protected] |
static TextureFontRef cinder::gl::TextureFont::create | ( | const Font & | font, |
const Format & | format = Format() , |
||
const std::string & | supportedChars = TextureFont::defaultChars() |
||
) | [static] |
Creates a new TextureFontRef with font font, ensuring that glyphs necessary to render supportedChars are renderable, and format format.
void cinder::gl::TextureFont::drawString | ( | const std::string & | str, |
const Vec2f & | baseline, | ||
const DrawOptions & | options = DrawOptions() |
||
) |
Draws string str at baseline baseline with DrawOptions options.
void cinder::gl::TextureFont::drawString | ( | const std::string & | str, |
const Rectf & | fitRect, | ||
const Vec2f & | offset = Vec2f::zero() , |
||
const DrawOptions & | options = DrawOptions() |
||
) |
Draws string str fit inside fitRect, with internal offset offset and DrawOptions options.
void cinder::gl::TextureFont::drawStringWrapped | ( | const std::string & | str, |
const Rectf & | fitRect, | ||
const Vec2f & | offset = Vec2f::zero() , |
||
const DrawOptions & | options = DrawOptions() |
||
) |
Draws word-wrapped string str fit inside fitRect, with internal offset offset and DrawOptions options. Mac & iOS only.
void cinder::gl::TextureFont::drawGlyphs | ( | const std::vector< std::pair< uint16_t, Vec2f > > & | glyphMeasures, |
const Vec2f & | 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.
void cinder::gl::TextureFont::drawGlyphs | ( | const std::vector< std::pair< uint16_t, Vec2f > > & | glyphMeasures, |
const Rectf & | clip, | ||
Vec2f | 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.
Vec2f cinder::gl::TextureFont::measureString | ( | const std::string & | str, |
const DrawOptions & | options = DrawOptions() |
||
) | const |
Returns the size in pixels necessary to render the string str with DrawOptions options.
Vec2f cinder::gl::TextureFont::measureStringWrapped | ( | 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.
vector< pair< uint16_t, Vec2f > > cinder::gl::TextureFont::getGlyphPlacements | ( | const std::string & | str, |
const DrawOptions & | options | ||
) | const |
Returns a vector of glyph/placement pairs representing str, suitable for use with drawGlyphs. Useful for caching placement and optimizing batching.
vector< pair< uint16_t, Vec2f > > cinder::gl::TextureFont::getGlyphPlacements | ( | const std::string & | str, |
const Rectf & | fitRect, | ||
const DrawOptions & | options | ||
) | 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.
const Font& cinder::gl::TextureFont::getFont | ( | ) | const |
Returns the font the TextureFont represents.
std::string cinder::gl::TextureFont::getName | ( | ) | const |
Returns the name of the font.
float cinder::gl::TextureFont::getAscent | ( | ) | const |
Returns the ascent of the font.
float cinder::gl::TextureFont::getDescent | ( | ) | const |
Returns the descent of the font.
bool cinder::gl::TextureFont::isPremultiplied | ( | ) | const |
Returns whether the TextureFont output premultipled output. Default is false
.
static std::string cinder::gl::TextureFont::defaultChars | ( | ) | [static] |
Returns the default set of characters for a TextureFont, suitable for most English text, including some common ligatures and accented vowels. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890().?!,:;'\"&*=+-/\#_
[]<>%^llflfiphrids"
boost::unordered_map<Font::Glyph, GlyphInfo> cinder::gl::TextureFont::mGlyphMap [protected] |
std::vector<gl::Texture> cinder::gl::TextureFont::mTextures [protected] |
Font cinder::gl::TextureFont::mFont [protected] |
Format cinder::gl::TextureFont::mFormat [protected] |