Class for labels in plots. More...
#include <label.hpp>
Public Member Functions | |
Label () | |
Label (const Label &label) | |
Label (const std::string &text) | |
~Label () | |
Label & | operator= (const Label &label) |
void | set_font_size (double size) |
Set label font size. More... | |
double | get_font_size (void) const |
Get label font size. More... | |
void | set_font_family (const std::string &family) |
Set label font family. More... | |
void | set_font_slant (cairo_font_slant_t slant) |
Set label font slant. More... | |
void | set_font_weight (cairo_font_weight_t weight) |
Set label font weight. More... | |
void | set_color (const Color &color) |
Set label color. More... | |
void | set_location (double x, double y) |
Set label location. More... | |
void | set_rotation (double angle) |
Set label rotation. More... | |
void | set_alignment (double x, double y, bool yzeroext=false) |
Set label alignment. More... | |
void | set_text (const std::string &text) |
Set label text. More... | |
std::string | get_text (void) const |
Get label text. More... | |
void | draw (cairo_t *cairo) |
Draw label. More... | |
void | get_extents (cairo_t *cairo, cairo_text_extents_t *extents) |
Get text extents of label. More... | |
void | get_bbox (cairo_t *cairo, double bbox[4]) const |
Get bounding box of label. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Label &label) |
Class for labels in plots.
Label can be used to draw text labels with latex formatting.
Label::Label | ( | ) |
Label::Label | ( | const Label & | label | ) |
Label::Label | ( | const std::string & | text | ) |
Label::~Label | ( | ) |
void Label::draw | ( | cairo_t * | cairo | ) |
Draw label.
void Label::get_bbox | ( | cairo_t * | cairo, |
double | bbox[4] | ||
) | const |
Get bounding box of label.
The bounding box takes in account the label rotation and aligment. The bounding box is always the size of the label in the direction of the axes. Bounding box is (xmin, ymin, xmax, ymax).
void Label::get_extents | ( | cairo_t * | cairo, |
cairo_text_extents_t * | extents | ||
) |
Get text extents of label.
The extents are independent of label rotation or alignment.
double Label::get_font_size | ( | void | ) | const |
Get label font size.
std::string Label::get_text | ( | void | ) | const |
Get label text.
void Label::set_alignment | ( | double | x, |
double | y, | ||
bool | yzeroext = false |
||
) |
Set label alignment.
Alignment of label relative to the set location point. Alignment (0,0) means the text is up and right from the point. (1,1) means the text is down and left from the point. Is either of aligment parameters is NaN or infinite, the text is laid so that the cursor starting position is at the set point.
If yzeroext is true, the label alignment in y-direction is made using the extents of character zero ("0") instead of the text itself.
void Label::set_color | ( | const Color & | color | ) |
Set label color.
void Label::set_font_family | ( | const std::string & | family | ) |
Set label font family.
void Label::set_font_size | ( | double | size | ) |
Set label font size.
void Label::set_font_slant | ( | cairo_font_slant_t | slant | ) |
Set label font slant.
void Label::set_font_weight | ( | cairo_font_weight_t | weight | ) |
Set label font weight.
void Label::set_location | ( | double | x, |
double | y | ||
) |
Set label location.
void Label::set_rotation | ( | double | angle | ) |
Set label rotation.
Rotation is set in radians. The positive angle direction is counter-clockwise.
void Label::set_text | ( | const std::string & | text | ) |
Set label text.
|
friend |