31 #if defined( _MSC_VER ) && ( _MSC_VER >= 1600 ) || defined( _LIBCPP_VERSION )
32 #include <unordered_map>
34 #include <boost/unordered_map.hpp>
37 namespace cinder {
namespace dx {
118 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>() );
120 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>() );
124 #if defined( CINDER_COCOA )
125 Vec2f measureStringWrapped(
const std::string &str,
const Rectf &fitRect,
const DrawOptions &options = DrawOptions() )
const;
147 static std::string defaultChars() {
return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890().?!,:;'\"&*=+-/\\@#_[]<>%^llflfiphrids\303\251\303\241\303\250\303\240"; }
158 #if defined( _MSC_VER ) && ( _MSC_VER >= 1600 ) || defined( _LIBCPP_VERSION )
159 std::unordered_map<Font::Glyph, GlyphInfo>
mGlyphMap;
Format & textureWidth(int32_t textureWidth)
Sets the width of the textures created internally for glyphs. Default 1024.
Definition: DxTextureFont.h:49
static std::string defaultChars()
Definition: DxTextureFont.h:147
bool mClipVertical
Definition: DxTextureFont.h:103
std::shared_ptr< class TextureFont > TextureFontRef
Definition: DxTextureFont.h:39
void enable(GLenum state)
Enables the OpenGL State state. Equivalent to calling to glEnable( state );.
Definition: dx.h:198
DrawOptions()
Definition: DxTextureFont.h:74
std::vector< dx::TextureRef > mTextures
Definition: DxTextureFont.h:163
TextureFont(const Font &font, const std::string &supportedChars, const Format &format)
GLsizei const GLchar ** string
Definition: GLee.h:2427
DrawOptions & clipHorizontal(bool clipH=true)
Sets whether the output clips horizontally.
Definition: DxTextureFont.h:79
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...
Definition: DxTextureFont.cpp:509
int32_t getTextureHeight() const
Sets the height of the textures created internally for glyphs. Default 1024.
Definition: DxTextureFont.h:55
Definition: DxTextureFont.h:152
DrawOptions & pixelSnap(bool pixelSnap=true)
Sets whether the output glyphs are snapped to pixel boundaries. This sharpens static text but prevent...
Definition: DxTextureFont.h:89
Definition: DxTextureFont.h:41
std::string getName() const
Returns the name of the font.
Definition: DxTextureFont.h:137
static Vec2< float > zero()
Definition: Vector.h:295
float getAscent() const
Returns the ascent of the font.
Definition: DxTextureFont.h:139
Definition: DxTextureFont.h:73
bool getClipVertical() const
Returns whether the output clips vertically.
Definition: DxTextureFont.h:82
Definition: DxTextureFont.h:43
Area mTexCoords
Definition: DxTextureFont.h:154
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...
Definition: DxTextureFont.cpp:536
boost::unordered_map< Font::Glyph, GlyphInfo > mGlyphMap
Definition: DxTextureFont.h:161
bool getPremultiply() const
Returns whether the TextureFont renders premultiplied output. Default false.
Definition: DxTextureFont.h:60
float getScale() const
Returns the scale at which the type is rendered. 2 is double size. Default 1.
Definition: DxTextureFont.h:97
void drawString(const std::string &str, const Vec2f &baseline, const DrawOptions &options=DrawOptions())
Draws string str at baseline baseline with DrawOptions options.
Definition: DxTextureFont.cpp:495
int32_t mTextureWidth
Definition: DxTextureFont.h:68
DrawOptions & scale(float sc)
Sets the scale at which the type is rendered. 2 is double size. Default 1.
Definition: DxTextureFont.h:99
Represents an instance of a font at a point size. Implicitly shared object.
Definition: Font.h:63
bool getPixelSnap() const
Returns whether the output glyphs are snapped to pixel boundaries. This sharpens static text but prev...
Definition: DxTextureFont.h:87
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 v...
float getDescent() const
Returns the descent of the font.
Definition: DxTextureFont.h:141
GLintptr offset
Definition: GLee.h:2095
bool mPixelSnap
Definition: DxTextureFont.h:103
Format mFormat
Definition: DxTextureFont.h:165
DrawOptions & clipVertical(bool clipV=true)
Sets whether the output clips vertically.
Definition: DxTextureFont.h:84
int32_t getTextureWidth() const
Returns the width of the textures created internally for glyphs. Default 1024.
Definition: DxTextureFont.h:51
bool hasMipmapping() const
Returns whether the TextureFont texture has mipmapping enabled.
Definition: DxTextureFont.h:65
bool getClipHorizontal() const
Returns whether the output clips horizontally.
Definition: DxTextureFont.h:77
bool isPremultiplied() const
Returns whether the TextureFont output premultipled output. Default is false.
Definition: DxTextureFont.h:143
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 ...
Definition: DxTextureFont.h:108
DrawOptions & ligate(bool useLigatures=true)
Sets whether advanced ligatures are used, which must have been instantiated by the supportedChars par...
Definition: DxTextureFont.h:94
bool mClipHorizontal
Definition: DxTextureFont.h:103
bool mPremultiply
Definition: DxTextureFont.h:69
int int int * dx
Definition: GLee.h:17162
float mScale
Definition: DxTextureFont.h:104
GLenum GLsizei GLenum format
Definition: GLee.h:969
const Font & getFont() const
Returns the font the TextureFont represents.
Definition: DxTextureFont.h:135
Format & textureHeight(int32_t textureHeight)
Sets the height of the textures created internally for glyphs. Default 1024.
Definition: DxTextureFont.h:53
int32_t mTextureHeight
Definition: DxTextureFont.h:68
bool mMipmapping
Definition: DxTextureFont.h:70
Format & enableMipmapping(bool enable=true)
Enables or disables mipmapping. Default is disabled.
Definition: DxTextureFont.h:63
bool getLigate() const
Returns whether advanced ligatures are used, which must have been instantiated by the supportedChars ...
Definition: DxTextureFont.h:92
const std::string & getName() const
Definition: Font.cpp:220
uint8_t mTextureIndex
Definition: DxTextureFont.h:153
bool mLigate
Definition: DxTextureFont.h:103
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.
Definition: DxTextureFont.cpp:516
Vec2f mOriginOffset
Definition: DxTextureFont.h:155
Format()
Definition: DxTextureFont.h:45
Font mFont
Definition: DxTextureFont.h:164
Format & premultiply(bool premult=true)
Sets whether the TextureFont render premultiplied output. Default false.
Definition: DxTextureFont.h:58