A piece of text. More...
#include <Shapes.h>
Public Member Functions | |
Text (double x, double y, const std::string &text, const Fonts::Font font, double size, Color color=Color::Black, int depth=-1) | |
Text (double x, double y, const std::string &text, const Fonts::Font font, const std::string &svgFont, double size, Color color=Color::Black, int depth=-1) | |
const std::string & | name () const |
Point | center () const |
Text & | rotate (double angle, const Point ¢er) |
Text | rotated (double angle, const Point ¢er) const |
Text & | rotate (double angle) |
Text | rotated (double angle) const |
Text & | translate (double dx, double dy) |
Text | translated (double dx, double dy) const |
Shape & | scale (double sx, double sy) |
Shape & | scale (double s) |
Text | scaled (double sx, double sy) const |
Text | scaled (double s) const |
void | scaleAll (double s) |
void | flushPostscript (std::ostream &stream, const TransformEPS &transform) const |
void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const |
void | flushSVG (std::ostream &stream, const TransformSVG &transform) const |
Rect | boundingBox () const |
Text * | clone () const |
Protected Attributes | |
Point | _position |
std::string | _text |
Fonts::Font | _font |
std::string | _svgFont |
double | _angle |
double | _size |
double | _xScale |
double | _yScale |
A piece of text.
The text structure.
examples/example2.cpp, examples/koch.cpp, examples/logo.cpp, and examples/ruler.cpp.
LibBoard::Text::Text | ( | double | x, | |
double | y, | |||
const std::string & | text, | |||
const Fonts::Font | font, | |||
double | size, | |||
Color | color = Color::Black , |
|||
int | depth = -1 | |||
) | [inline] |
LibBoard::Text::Text | ( | double | x, | |
double | y, | |||
const std::string & | text, | |||
const Fonts::Font | font, | |||
const std::string & | svgFont, | |||
double | size, | |||
Color | color = Color::Black , |
|||
int | depth = -1 | |||
) | [inline] |
Create a Text sctucture.
x | ||
y | ||
text | ||
font | ||
svgFont | The font family for an SVG file. (E.g. "Verdana, Arial" or "'Time New Roman', Serif" ) | |
size | The font size expressed in 1/72 inches. | |
color | ||
depth |
Rect LibBoard::Text::boundingBox | ( | ) | const [virtual] |
Returns the bounding box of the figure.
Implements LibBoard::Shape.
References LibBoard::Point::x, and LibBoard::Point::y.
Point LibBoard::Text::center | ( | ) | const [virtual] |
Returns the gravity center of the shape.
Implements LibBoard::Shape.
Text * LibBoard::Text::clone | ( | ) | const [virtual] |
void LibBoard::Text::flushFIG | ( | std::ostream & | stream, | |
const TransformFIG & | transform, | |||
std::map< Color, int > & | colormap | |||
) | const [virtual] |
Writes the FIG code of the shape in a stream according to a transform.
stream | The output stream. | |
transform | A 2D transform to be applied. |
Implements LibBoard::Shape.
References LibBoard::Shape::_depth, LibBoard::Shape::_penColor, LibBoard::Point::x, and LibBoard::Point::y.
void LibBoard::Text::flushPostscript | ( | std::ostream & | stream, | |
const TransformEPS & | transform | |||
) | const [virtual] |
Writes the EPS code of the shape in a stream according to a transform.
stream | The output stream. | |
transform | A 2D transform to be applied. |
Implements LibBoard::Shape.
References LibBoard::Shape::_penColor, LibBoard::Point::x, and LibBoard::Point::y.
void LibBoard::Text::flushSVG | ( | std::ostream & | stream, | |
const TransformSVG & | transform | |||
) | const [virtual] |
Writes the SVG code of the shape in a stream according to a transform.
stream | The output stream. | |
transform | A 2D transform to be applied. |
Implements LibBoard::Shape.
References LibBoard::Shape::_penColor, LibBoard::Color::svgAlpha(), LibBoard::Point::x, and LibBoard::Point::y.
const std::string & LibBoard::Text::name | ( | ) | const [virtual] |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
Text & LibBoard::Text::rotate | ( | double | angle | ) | [virtual] |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. | |
center | The center of rotation. |
Implements LibBoard::Shape.
References LibBoard::Point::rotate(), LibBoard::Point::x, and LibBoard::Point::y.
Shape & LibBoard::Text::scale | ( | double | s | ) | [virtual] |
Scale the shape along both axis.
s | The scale factor along both axis. |
Implements LibBoard::Shape.
Shape & LibBoard::Text::scale | ( | double | sx, | |
double | sy | |||
) | [virtual] |
Scale the shape along the x an y axis.
sx | The scale factor along the x axis. | |
sy | The scale factor along the y axis. |
Implements LibBoard::Shape.
void LibBoard::Text::scaleAll | ( | double | s | ) | [virtual] |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implements LibBoard::Shape.
Text & LibBoard::Text::translate | ( | double | dx, | |
double | dy | |||
) | [virtual] |
Translate the shape by a given offset.
dx | The x offset. | |
dy | The y offset. |
Implements LibBoard::Shape.