Board  0.9.2
Public Member Functions | Protected Attributes | List of all members
LibBoard::Text Struct Reference

A piece of text. More...

#include <Shapes.h>

Inheritance diagram for LibBoard::Text:
LibBoard::Shape

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
 
Textrotate (double angle, const Point &center)
 
Text rotated (double angle, const Point &center) const
 
Textrotate (double angle)
 
Text rotated (double angle) const
 
Texttranslate (double dx, double dy)
 
Text translated (double dx, double dy) const
 
Textscale (double sx, double sy)
 
Textscale (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
 
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const
 
Rect boundingBox () const
 
Textclone () const
 
- Public Member Functions inherited from LibBoard::Shape
 Shape (Color penColor, Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
 
virtual ~Shape ()
 
bool filled () const
 
ShaperotateDeg (double angle, const Point &center)
 
ShaperotateDeg (double angle)
 
ShapemoveCenter (double x, double y)
 
ShapemoveCenter (Point p)
 
Rect bbox () const
 
Shapeoperator-- ()
 
Shapeoperator++ ()
 
int depth () const
 
virtual void depth (int)
 
virtual void shiftDepth (int shift)
 
const ColorpenColor () const
 
const ColorfillColor () const
 

Protected Attributes

Point _position
 
std::string _text
 
Fonts::Font _font
 
std::string _svgFont
 
double _angle
 
double _size
 
double _xScale
 
double _yScale
 
- Protected Attributes inherited from LibBoard::Shape
int _depth
 
Color _penColor
 
Color _fillColor
 
double _lineWidth
 
LineStyle _lineStyle
 
LineCap _lineCap
 
LineJoin _lineJoin
 

Additional Inherited Members

- Public Types inherited from LibBoard::Shape
enum  LineCap { ButtCap = 0, RoundCap, SquareCap }
 
enum  LineJoin { MiterJoin = 0, RoundJoin, BevelJoin }
 
enum  LineStyle {
  SolidStyle = 0, DashStyle, DotStyle, DashDotStyle,
  DashDotDotStyle, DashDotDotDotStyle
}
 
- Protected Member Functions inherited from LibBoard::Shape
std::string svgProperties (const TransformSVG &transform) const
 
std::string postscriptProperties () const
 
std::string tikzProperties (const TransformTikZ &transform) const
 

Detailed Description

A piece of text.

The text structure.

Examples:
examples/example2.cpp, examples/koch.cpp, examples/logo.cpp, and examples/ruler.cpp.

Constructor & Destructor Documentation

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

Create a Text sctucture.

Parameters
x
y
text
font
sizeThe font size expressed in 1/72 inches.
color
depth
Returns

Referenced by clone(), scaled(), and translated().

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.

Parameters
x
y
text
font
svgFontThe font family for an SVG file. (E.g. "Verdana, Arial" or "'Time New Roman', Serif" )
sizeThe font size expressed in 1/72 inches.
color
depth
Returns

Member Function Documentation

Rect LibBoard::Text::boundingBox ( ) const
virtual

Compute the bounding box of the figure.

Returns
The rectangle of the bounding box.

Implements LibBoard::Shape.

References LibBoard::Point::x, and LibBoard::Point::y.

Point LibBoard::Text::center ( ) const
virtual

Returns the center of the shape.

Returns
The center of the shape, i.e. the center of its bounding box.

Reimplemented from LibBoard::Shape.

Text * LibBoard::Text::clone ( ) const
virtual

Return a copy of the shape.

Returns
A copy of the shape.

Implements LibBoard::Shape.

References Text().

void LibBoard::Text::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< Color, int > &  colormap 
) const
virtual

Write the FIG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 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

Write the EPS code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 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

Write the SVG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::Shape::_penColor, LibBoard::Color::svgAlpha(), LibBoard::Point::x, and LibBoard::Point::y.

void LibBoard::Text::flushTikZ ( std::ostream &  stream,
const TransformTikZ transform 
) const
virtual

Write the TikZ code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::Shape::tikzProperties(), 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.)

Returns

Reimplemented from LibBoard::Shape.

Text & LibBoard::Text::rotate ( double  angle,
const Point center 
)
virtual

Rotate the shape around a given center of rotation.

Parameters
angleThe rotation angle in radian.
centerThe center of rotation.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

References LibBoard::Point::norm(), LibBoard::Point::rotate(), LibBoard::Point::x, and LibBoard::Point::y.

Text & LibBoard::Text::rotate ( double  angle)
virtual

Rotate the shape around its center.

Parameters
angleThe rotation angle in radian.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Text & LibBoard::Text::scale ( double  sx,
double  sy 
)
virtual

Scale the text, given two scaling factors.

Parameters
sxScaling factor along the x axis.
syScaling factor along the y axis.
Returns
A reference to the text itself, once scaled.

Implements LibBoard::Shape.

Text & LibBoard::Text::scale ( double  s)
virtual

Scale the text, given a scaling factor.

Parameters
sScaling factor.
Returns
A reference to the text itself, once scaled.

Implements LibBoard::Shape.

void LibBoard::Text::scaleAll ( double  s)
virtual

Scales all the values (positions, dimensions, etc.) associated with the shape.

Parameters
sThe scaling factor.

Implements LibBoard::Shape.

Text LibBoard::Text::scaled ( double  sx,
double  sy 
) const

Returns a scaled copy of the text.

Parameters
sxThe scaling factor along the x axis.
syThe scaling factor along the y axis.
Returns
A scaled copy of the text.

References Text().

Text LibBoard::Text::scaled ( double  s) const

Returns a scaled copy of the text.

Parameters
sThe scaling factor.
Returns
A scaled copy of the text.

References Text().

Text & LibBoard::Text::translate ( double  dx,
double  dy 
)
virtual

Translate the text by a given offset.

Parameters
dxThe x offset.
dyThe y offset.
Returns
A reference to the text itself.

Implements LibBoard::Shape.

Text LibBoard::Text::translated ( double  dx,
double  dy 
) const

Returns a translated copy of the text.

Parameters
dxShift of the first coordinate.
dyShift of the second coordinate.
Returns
A copy of the text, translated.

References Text().


The documentation for this struct was generated from the following files: