Ipelib
|
The text object. More...
#include <ipetext.h>
Inherits ipe::Object.
The text object.
The text object stores 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 textType() 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().
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.
enum ipe::Text::TextType |
Text::Text | ( | ) | [explicit] |
Construct an empty internal text object.
Text::Text | ( | const AllAttributes & | attr, |
String | data, | ||
const Vector & | pos, | ||
TextType | type, | ||
double | width = 10.0 |
||
) | [explicit] |
Create text object.
Text::Text | ( | const Text & | rhs | ) |
Copy constructor.
Text::~Text | ( | ) |
Destructor.
Text::Text | ( | const XmlAttributes & | attr, |
String | data | ||
) | [explicit] |
Create from XML stream.
Object * Text::clone | ( | ) | const [virtual] |
Clone object.
Implements ipe::Object.
Text * Text::asText | ( | ) | [virtual] |
Return pointer to this object.
Reimplemented from ipe::Object.
Object::Type Text::type | ( | ) | const [virtual] |
Implements ipe::Object.
Save object to XML stream.
Implements ipe::Object.
void Text::draw | ( | Painter & | painter | ) | const [virtual] |
Save text as PDF.
Implements ipe::Object.
void Text::drawSimple | ( | Painter & | painter | ) | const [virtual] |
Draw simple version for selecting and transforming.
Implements ipe::Object.
void Text::accept | ( | Visitor & | visitor | ) | const [virtual] |
Call visitText of visitor.
Implements ipe::Object.
Extend box to include the object transformed by m.
For objects in a page, don't call this directly. The Page caches the bounding box of each object, so it is far more efficient to call Page::bbox.
Control points that lie outside the visual object are included if cp is true.
If called with an empty box and cp == false
, 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 ipe::Object.
Return distance of transformed object to point v. If larger than bound, can just return bound.
Implements ipe::Object.
void Text::snapVtx | ( | const Vector & | mouse, |
const Matrix & | m, | ||
Vector & | 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 ipe::Object.
void Text::checkStyle | ( | const Cascade * | sheet, |
AttributeSeq & | seq | ||
) | const [virtual] |
Check symbolic size attribute.
Reimplemented from ipe::Object.
bool Text::setAttribute | ( | Property | prop, |
Attribute | value, | ||
Attribute | stroke, | ||
Attribute | fill | ||
) | [virtual] |
Set an attribute on this object.
Returns true if an attribute was actually changed. The arguments stroke and fill are only used then prop is EPropPathMode, and stroking or filling is added to an object that didn't have it before.
Reimplemented from ipe::Object.
Get setting of an attribute of this object.
If object does not have this attribute, returnes "undefined" attribute.
Reimplemented from ipe::Object.
Vector Text::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.
Text::TextType Text::textType | ( | ) | const |
Return type of text object.
Vector ipe::Text::position | ( | ) | const [inline] |
Return text position.
String ipe::Text::text | ( | ) | const [inline] |
Return text source.
void Text::setStroke | ( | Attribute | stroke | ) |
Set stroke color.
void Text::setOpacity | ( | Attribute | opaq | ) |
Set opacity of the object.
Attribute ipe::Text::stroke | ( | ) | const [inline] |
Return stroke color.
Attribute ipe::Text::size | ( | ) | const [inline] |
Return font size.
Attribute ipe::Text::opacity | ( | ) | const [inline] |
Return opacity of the opject.
bool ipe::Text::isMinipage | ( | ) | const [inline] |
Return true if text object is formatted as a minipage.
Equivalent to type being EMinipage.
void Text::setTextType | ( | TextType | type | ) |
Change type.
THorizontalAlignment ipe::Text::horizontalAlignment | ( | ) | const [inline] |
Return horizontal alignment of text object.
TVerticalAlignment ipe::Text::verticalAlignment | ( | ) | const [inline] |
Return vertical alignment of text object.
void Text::setHorizontalAlignment | ( | THorizontalAlignment | align | ) |
Change horizontal alignment (text moves with respect to reference point).
void Text::setVerticalAlignment | ( | TVerticalAlignment | align | ) |
Change vertical alignment (text moves with respect to reference point).
TVerticalAlignment Text::makeVAlign | ( | String | str, |
TVerticalAlignment | def | ||
) | [static] |
Return vertical alignment indicated by a name, or else default.
THorizontalAlignment Text::makeHAlign | ( | String | str, |
THorizontalAlignment | def | ||
) | [static] |
Return horizontal alignment indicated by a name, or else default.
void Text::saveAlignment | ( | Stream & | stream, |
THorizontalAlignment | h, | ||
TVerticalAlignment | v | ||
) | [static] |
double ipe::Text::width | ( | ) | const [inline] |
Return width of text object.
double ipe::Text::height | ( | ) | const [inline] |
Return height of text object (from baseline to top).
double ipe::Text::depth | ( | ) | const [inline] |
Return depth of text object.
double ipe::Text::totalHeight | ( | ) | const [inline] |
Return height + depth of text object.
void Text::setSize | ( | Attribute | size | ) |
Set font size of text.
This invalidates (and destroys) the XForm.
void Text::setStyle | ( | Attribute | style | ) |
void Text::setWidth | ( | double | width | ) |
Set width of paragraph.
This invalidates (and destroys) the XForm. The function panics if object is not a (true) minipage.
void Text::setText | ( | String | text | ) |
Sets the text of the text object.
This invalidates (and destroys) the XForm.
bool ipe::Text::isInternal | ( | ) | const [inline] |
void Text::setXForm | ( | XForm * | xform | ) | const |
Update the PDF code for this object.
const Text::XForm * ipe::Text::getXForm | ( | ) | const [inline] |
Return the PDF representation of this text object.
If Pdflatex has not been run yet, returns 0.