In progress... show_text() -> Text.vala

This commit is contained in:
Kolan Sh 2018-01-10 11:02:47 +03:00
parent d67e2c2691
commit 6f5e5773d2
2 changed files with 15 additions and 11 deletions

View File

@ -201,17 +201,7 @@ namespace CairoChart {
public double title_indent = 4;
public virtual void show_text(Text text) {
context.select_font_face(text.style.family,
text.style.slant,
text.style.weight);
context.set_font_size(text.style.size);
if (text.style.orientation == Font.Orientation.VERTICAL) {
context.rotate(- Math.PI / 2.0);
context.show_text(text.text);
context.rotate(Math.PI / 2.0);
} else {
context.show_text(text.text);
}
text.show(context);
}
protected virtual void draw_chart_title () {

View File

@ -52,6 +52,20 @@ namespace CairoChart {
return sz;
}
public void show (Cairo.Context context) {
context.select_font_face(style.family,
style.slant,
style.weight);
context.set_font_size(style.size);
if (style.orientation == Font.Orientation.VERTICAL) {
context.rotate(- Math.PI / 2.0);
context.show_text(text);
context.rotate(Math.PI / 2.0);
} else {
context.show_text(text);
}
}
public Text (string text = "",
Font.Style style = Font.Style(),
Color color = Color()) {