#include <DxTextureFont.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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
const Font & | getFont () const |
Returns the font the TextureFont represents. More... | |
std::string | getName () const |
Returns the name of the font. More... | |
float | getAscent () const |
Returns the ascent of the font. More... | |
float | getDescent () const |
Returns the descent of the font. More... | |
bool | isPremultiplied () const |
Returns whether the TextureFont output premultipled output. Default is false . More... | |
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. More... | |
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< dx::TextureRef > | mTextures |
Font | mFont |
Format | mFormat |
|
protected |
|
static |
Creates a new TextureFontRef with font font, ensuring that glyphs necessary to render supportedChars are renderable, and format format.
void cinder::dx::TextureFont::drawString | ( | const std::string & | str, |
const Vec2f & | baseline, | ||
const DrawOptions & | options = DrawOptions() |
||
) |
Draws string str at baseline baseline with DrawOptions options.
void cinder::dx::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::dx::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::dx::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::dx::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::dx::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.
vector< pair< uint16_t, Vec2f > > cinder::dx::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::dx::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::dx::TextureFont::getFont | ( | ) | const |
Returns the font the TextureFont represents.
std::string cinder::dx::TextureFont::getName | ( | ) | const |
Returns the name of the font.
float cinder::dx::TextureFont::getAscent | ( | ) | const |
Returns the ascent of the font.
float cinder::dx::TextureFont::getDescent | ( | ) | const |
Returns the descent of the font.
bool cinder::dx::TextureFont::isPremultiplied | ( | ) | const |
Returns whether the TextureFont output premultipled output. Default is false
.
|
static |
Returns the default set of characters for a TextureFont, suitable for most English text, including some common ligatures and accented vowels. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890().?!,:;'\"&*=+-/\#_
[]<>%^llflfiphrids"
|
protected |
|
protected |
|
protected |
|
protected |