36 #if defined( CINDER_COCOA )
75 void setBorder(
int horizontal,
int vertical );
78 Surface render(
bool useAlpha =
false,
bool premultiplied =
false );
84 float mCurrentLeadingOffset;
85 int mHorizontalBorder, mVerticalBorder;
87 std::deque<std::shared_ptr<class Line> > mLines;
95 TextBox() :
mAlign(
LEFT ),
mSize(
GROW,
GROW ),
mFont(
Font::getDefault() ),
mInvalid( true ),
mColor( 1, 1, 1, 1 ),
mBackgroundColor( 0, 0, 0, 0 ),
mPremultiplied( false ),
mLigate( true ) {}
134 std::vector<std::pair<uint16_t,Vec2f> >
measureGlyphs()
const;
149 #if defined( CINDER_COCOA )
150 void createLines()
const;
152 mutable std::vector<std::pair<std::shared_ptr<const __CTLine>,
Vec2f> > mLines;
153 #elif defined( CINDER_MSW )
154 std::vector<std::string> calculateLineBreaks()
const;
155 void calculate()
const;
157 mutable std::u16string mWideText;
158 #elif defined( CINDER_WINRT )
159 std::vector<std::string> calculateLineBreaks()
const;
167 #if defined( CINDER_COCOA_TOUCH )
void setSize(Vec2i sz)
Definition: Text.h:100
ColorA getBackgroundColor() const
Definition: Text.h:120
void setBackgroundColor(ColorA bgColor)
Definition: Text.h:121
TextBox & premultiplied(bool premult=true)
Definition: Text.h:123
void setPremultiplied(bool premult)
Definition: Text.h:125
void setColor(ColorA color)
Definition: Text.h:117
TextLayout()
This is an abstract line.
Definition: Text.cpp:304
ColorA mBackgroundColor
Definition: Text.h:143
bool getPremultiplied() const
Definition: Text.h:124
GLsizei const GLchar ** string
Definition: GLee.h:2427
Font mFont
Definition: Text.h:142
bool getLigate() const
Definition: Text.h:128
GLenum GLsizei width
Definition: GLee.h:969
Surface render(Vec2f offset=Vec2f::zero())
static Vec2< float > zero()
Definition: Vector.h:295
bool mPremultiplied
Definition: Text.h:144
void setLeadingOffset(float leadingOffset)
Sets an offset relative to the default leading (the vertical space between lines).
Definition: Text.cpp:366
Surface render(bool useAlpha=false, bool premultiplied=false)
Returns a Surface into which the TextLayout is rendered. If useAlpha the Surface will contain an alph...
Definition: Text.cpp:387
Alignment
Definition: Text.h:92
TextBox & font(const Font &f)
Definition: Text.h:107
const std::string & getText() const
Definition: Text.h:103
void addLine(const std::string &line)
Adds a left-justified line of text to the layout. Assumes UTF-8 encoding.
Definition: Text.cpp:326
TextBox & color(ColorA color)
Definition: Text.h:115
std::string mText
Definition: Text.h:141
TextBox()
Definition: Text.h:95
GLenum GLsizei GLsizei height
Definition: GLee.h:1029
void setBorder(int horizontal, int vertical)
Adds a horizontal pixel border to the left and the right sides, and a vertical border to the top and ...
Definition: Text.cpp:371
Represents an instance of a font at a point size. Implicitly shared object.
Definition: Font.h:63
void clear(const Color &color)
Sets the background color for the TextLayout. Implicit opqaue alpha.
Definition: Text.cpp:316
ColorA mColor
Definition: Text.h:143
bool mInvalid
Definition: Text.h:146
TextBox & backgroundColor(ColorA bgColor)
Definition: Text.h:119
GLintptr offset
Definition: GLee.h:2095
void addRightLine(const std::string &line)
Adds a right-justified line of text to the layout. Assumes UTF-8 encoding.
Definition: Text.cpp:344
const Font & getFont() const
Definition: Text.h:108
ColorA getColor() const
Definition: Text.h:116
Surface renderString(const std::string &str, const Font &font, const ColorA &color, float *baselineOffset=0)
Renders a single string and returns it as a Surface. Optional baselineOffset pointer will receive how...
TextBox & alignment(Alignment align)
Definition: Text.h:111
TextBox & size(int width, int height)
Definition: Text.h:98
void addCenteredLine(const std::string &line)
Adds a centered line of text to the layout. Assumes UTF-8 encoding.
Definition: Text.cpp:335
Vec2i getSize() const
Definition: Text.h:99
TextBox & text(const std::string &t)
Definition: Text.h:102
void setAlignment(Alignment align)
Definition: Text.h:113
bool mLigate
Definition: Text.h:145
void setText(const std::string &t)
Definition: Text.h:104
void setColor(const Color &color)
Sets the currently active color. Implicit opqaue alpha.
Definition: Text.cpp:377
void append(const std::string &str)
Appends string str to the current line. Assumes UTF-8 encoding.
Definition: Text.cpp:353
std::vector< std::pair< uint16_t, Vec2f > > measureGlyphs() const
Vec2f mCalculatedSize
Definition: Text.h:148
Alignment mAlign
Definition: Text.h:139
void setFont(const Font &font)
Definition: Text.cpp:361
Vec2i mSize
Definition: Text.h:140
Alignment getAlignment() const
Definition: Text.h:112
TextBox & ligate(bool ligateText=true)
Definition: Text.h:127
GLdouble GLdouble t
Definition: GLee.h:1426
GLclampf f
Definition: GLee.h:15307
void setFont(const Font &f)
Definition: Text.h:109
void setLigate(bool ligateText)
Definition: Text.h:129
TextBox & size(Vec2i sz)
Definition: Text.h:97
Vec2< int > Vec2i
Definition: Vector.h:1313
void appendText(const std::string &t)
Definition: Text.h:105
GLuint color
Definition: GLee.h:3198