# LibBoard::Text Struct Reference

A piece of text. More...

`#include <Shapes.h>`

Inheritance diagram for LibBoard::Text:

List of all members.

## 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 &center)
Text | rotated (double angle, const Point &center) 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

## 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 |
  | size | The font size expressed in 1/72 inches.
  | color |
  | depth |

Returns:

Referenced by clone().

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 |
  | 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 |

Returns:

## Member Function Documentation

Rect LibBoard::Text::boundingBox | ( |  | ) | const`[virtual]`

Returns 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 gravity center of the shape.

Returns:
  The center of the shape.

Implements LibBoard::Shape.

Text * LibBoard::Text::clone | ( |  | ) | const`[virtual]`

Return a copy of the shape.

Returns:

Implements LibBoard::Shape.

References Text().

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.

Parameters:

  | 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.

Parameters:

  | 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.

Parameters:

  | 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.)

Returns:

Reimplemented from LibBoard::Shape.

Text & LibBoard::Text::rotate | ( | double | angle | ) | `[virtual]`

Rotate the shape around its center.

Parameters:

  | angle | The rotation angle in radian.

Returns:
  A reference to the shape itself.

Implements LibBoard::Shape.

Text & LibBoard::Text::rotate | ( | double | angle,
|  | const Point & | center |
| ) |  |  | `[virtual]`

Rotate the shape around a given center of rotation.

Parameters:

  | angle | The rotation angle in radian.
  | center | The center of rotation.

Returns:
  A reference to the shape itself.

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.

Parameters:

  | s | The scale factor along both axis.

Returns:
  The shape itself.

Implements LibBoard::Shape.

Shape & LibBoard::Text::scale | ( | double | sx,
|  | double | sy |
| ) |  |  | `[virtual]`

Scale the shape along the x an y axis.

Parameters:

  | sx | The scale factor along the x axis.
  | sy | The scale factor along the y axis.

Returns:
  The shape itself.

Implements LibBoard::Shape.

void LibBoard::Text::scaleAll | ( | double | s | ) | `[virtual]`

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

Parameters:

  | s | The scaling factor.

Implements LibBoard::Shape.

Text & LibBoard::Text::translate | ( | double | dx,
|  | double | dy |
| ) |  |  | `[virtual]`

Translate the shape by a given offset.

Parameters:

  | dx | The x offset.
  | dy | The y offset.

Returns:
  A reference to the shape itself.

Implements LibBoard::Shape.

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

- include/board/Shapes.h
- src/Shapes.cpp