- Main Page
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

# IpeText Class Reference
[Ipe Objects]

The text object. More...

Inherits IpeObject.

List of all members.

## Public Types

- enum THorizontalAlignment { ELeft, ERight, EHCenter }
- enum TVerticalAlignment { EBottom, EBaseline, ETop, EVCenter }
- enum TType { ELabel = 1, EMinipage }

## Public Member Functions

- IpeText ()
- IpeText (const IpeAllAttributes &attr, IpeString data, const IpeVector &pos, TType type, IpeScalar width=10.0)
- IpeText (IpeRepository *rep, const IpeXmlAttributes &attr, IpeString data)
- IpeText (const IpeText &rhs)
- ~IpeText ()
- virtual IpeObject * Clone () const
- virtual IpeText * AsText ()
- virtual void SaveAsXml (IpePainter &painter, IpeStream &stream, IpeString layer) const
- virtual void Draw (IpePainter &painter) const
- virtual void Accept (IpeVisitor &visitor) const
- virtual void AddToBBox (IpeRect &box, const IpeMatrix &m) const
- virtual double Distance (const IpeVector &v, const IpeMatrix &m, double bound) const
- virtual void SnapVtx (const IpeVector &mouse, const IpeMatrix &m, IpeVector &pos, double &bound) const
- virtual void CheckStyle (const IpeStyleSheet *sheet, IpeAttributeSeq &seq) const
- IpeVector Align () const
- TType Type () const
- IpeVector Position () const
- IpeString Text () const
- IpeAttribute Size () const
- IpeAttribute Style () const
- bool isMinipage () const
- void SetType (TType type)
- THorizontalAlignment HorizontalAlignment () const
- TVerticalAlignment VerticalAlignment () const
- void SetHorizontalAlignment (THorizontalAlignment align)
- void SetVerticalAlignment (TVerticalAlignment align)
- IpeScalar Width () const
- IpeScalar Height () const
- IpeScalar Depth () const
- IpeScalar TotalHeight () const
- bool IsTransformable () const
- void SetTransformable (bool transf)
- void SetSize (IpeAttribute size)
- void SetStyle (IpeAttribute style)
- void SetWidth (IpeScalar width)
- void SetText (IpeString text)
- bool isInternal () const
- void setXForm (XForm *xform) const
- const XForm * getXForm () const

## Static Public Member Functions

- static TVerticalAlignment makeVAlign (IpeString str, TVerticalAlignment def)
- static THorizontalAlignment makeHAlign (IpeString str, THorizontalAlignment def)
- static void saveAlignment (IpeStream &stream, THorizontalAlignment h, TVerticalAlignment v)

## Detailed Description

The text object.

The text object is a tricky Ipe object. It has a Latex-source representation, which needs to be translated into PDF by Pdflatex before it can be saved as PDF.

There are two types of text objects: labels and minipages. The Type() method tells you which, or use isMinipage().

The dimensions of a text object are given by Width(), Height(), and Depth(). They are recomputed by Ipe when running LaTeX, with the exception of the width for minipage objects (whose width is fixed). Before Latex has been run, the dimensions are not reliable.

The position of the reference point relative to the text box is given by VerticalAlignment() and HorizontalAlignment().

Text can be either transformable, or fixed. In the first case, the Matrix() is applied to the complete text box, in the second case, the Matrix() is only applied to the reference point Position(), and the text box remains fixed relative to the reference point.

The Text() must be a legal LaTeX fragment that can be interpreted by LaTeX inside `\hbox`, possibly using the macros or packages defined in the preamble.

## Constructor & Destructor Documentation

IpeText::IpeText | ( |  | ) | `[explicit]`

Construct an empty internal text object.

IpeText::IpeText | ( | const IpeAllAttributes & | attr,
|  | IpeString | data,
|  | const IpeVector & | pos,
|  | TType | type,
|  | IpeScalar | width = `10.0` |
| ) |  |  | `[explicit]`

Create text object.

IpeText::IpeText | ( | IpeRepository * | rep,
|  | const IpeXmlAttributes & | attr,
|  | IpeString | data |
| ) |  |  | `[explicit]`

Create from XML stream.

IpeText::IpeText | ( | const IpeText & | rhs | ) |

Copy constructor.

IpeText::~IpeText | ( |  | ) |

Destructor.

## Member Function Documentation

IpeObject * IpeText::Clone | ( |  | ) | const`[virtual]`

Clone object.

Implements IpeObject.

IpeText * IpeText::AsText | ( |  | ) | `[virtual]`

Return pointer to this object.

Reimplemented from IpeObject.

void IpeText::SaveAsXml | ( | IpePainter & | painter,
|  | IpeStream & | stream,
|  | IpeString | layer |
| ) |  |  | const`[virtual]`

Save object to XML stream.

Implements IpeObject.

void IpeText::Draw | ( | IpePainter & | painter | ) | const`[virtual]`

Save text as PDF.

Implements IpeObject.

void IpeText::Accept | ( | IpeVisitor & | visitor | ) | const`[virtual]`

Call VisitText of visitor.

Implements IpeObject.

void IpeText::AddToBBox | ( | IpeRect & | box,
|  | const IpeMatrix & | m |
| ) |  |  | const`[virtual]`

Extend box to include the object transformed by m.

For Ipe objects in a page, don't call this directly. The IpePgObject caches the bounding box, so it is far more efficient to call IpePgObject::BBox.

If called with an empty box, the result of this function is a tight bounding box for the object, with a little leeway in case the boundary is determined by a spline (it has to be approximated to perform this operation).

Implements IpeObject.

double IpeText::Distance | ( | const IpeVector & | v,
|  | const IpeMatrix & | m,
|  | double | bound |
| ) |  |  | const`[virtual]`

Return distance of transformed object to point v. If larger than bound, can just return bound.

Implements IpeObject.

void IpeText::SnapVtx | ( | const IpeVector & | mouse,
|  | const IpeMatrix & | m,
|  | IpeVector & | pos,
|  | double & | bound |
| ) |  |  | const`[virtual]`

Compute possible vertex snapping position for transformed object.

Looks only for positions closer than bound. If successful, modify pos and bound.

Implements IpeObject.

void IpeText::CheckStyle | ( | const IpeStyleSheet * | sheet,
|  | IpeAttributeSeq & | seq |
| ) |  |  | const`[virtual]`

Check symbolic size attribute.

Reimplemented from IpeObject.

IpeVector IpeText::Align | ( |  | ) | const

Return position of reference point in text box coordinate system.

Assume a coordinate system where the text box has corners (0,0) and (Width(), TotalHeight()). This function returns the coordinates of the reference point in this coordinate system.

IpeText::TType IpeText::Type | ( |  | ) | const

Return type of text object.

IpeVector IpeText::Position | ( |  | ) | const`[inline]`

Return text position.

IpeString IpeText::Text | ( |  | ) | const`[inline]`

Return text source.

IpeAttribute IpeText::Size | ( |  | ) | const`[inline]`

Return font size.

IpeAttribute IpeText::Style | ( |  | ) | const`[inline]`

Return Latex style of text object.

bool IpeText::isMinipage | ( |  | ) | const`[inline]`

Return true if text object is formatted as a minipage.

Equivalent to type being EMinipage.

void IpeText::SetType | ( | TType | type | ) |

Change type.

IpeText::THorizontalAlignment IpeText::HorizontalAlignment | ( |  | ) | const`[inline]`

Return horizontal alignment of text object.

IpeText::TVerticalAlignment IpeText::VerticalAlignment | ( |  | ) | const`[inline]`

Return vertical alignment of text object.

void IpeText::SetHorizontalAlignment | ( | THorizontalAlignment | align | ) |

Change horizontal alignment (text moves with respect to reference point).

void IpeText::SetVerticalAlignment | ( | TVerticalAlignment | align | ) |

Change vertical alignment (text moves with respect to reference point).

IpeText::TVerticalAlignment IpeText::makeVAlign | ( | IpeString | str,
|  | TVerticalAlignment | def |
| ) |  |  | `[static]`

Return vertical alignment indicated by a name, or else default.

IpeText::THorizontalAlignment IpeText::makeHAlign | ( | IpeString | str,
|  | THorizontalAlignment | def |
| ) |  |  | `[static]`

Return horizontal alignment indicated by a name, or else default.

IpeScalar IpeText::Width | ( |  | ) | const`[inline]`

Return width of text object.

IpeScalar IpeText::Height | ( |  | ) | const`[inline]`

Return height of text object (from baseline to top).

IpeScalar IpeText::Depth | ( |  | ) | const`[inline]`

Return depth of text object.

IpeScalar IpeText::TotalHeight | ( |  | ) | const`[inline]`

Return height + depth of text object.

bool IpeText::IsTransformable | ( |  | ) | const`[inline]`

Return true if text object can be transformed.

void IpeText::SetTransformable | ( | bool | transf | ) |

Set whether the text object can be transformed.

This invalidates (and destroys) the XForm. This function panics if called on textbox or title.

void IpeText::SetSize | ( | IpeAttribute | size | ) |

Set font size of text.

This invalidates (and destroys) the XForm.

void IpeText::SetStyle | ( | IpeAttribute | style | ) |

Set Latex style of text.

This invalidates (and destroys) the XForm.

void IpeText::SetWidth | ( | IpeScalar | width | ) |

Set width of paragraph.

This invalidates (and destroys) the XForm. The function panics if object is not a (true) minipage.

void IpeText::SetText | ( | IpeString | text | ) |

Sets the text of the text object.

This invalidates (and destroys) the XForm.

void IpeText::setXForm | ( | XForm * | xform | ) | const

Update the PDF code for this object.

const IpeText::XForm * IpeText::getXForm | ( |  | ) | const`[inline]`

Return the PDF representation of this text object.

If Pdflatex has not been run yet, returns 0.

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

- ipetext.h
- ipetext.cpp