Cairo-Chart/src/Font.vala

91 lines
1.8 KiB
Vala
Raw Normal View History

2018-01-08 23:33:13 +03:00
namespace CairoChart {
2018-01-20 13:11:17 +03:00
/**
* ``Font`` style.
*/
2018-01-21 18:41:41 +03:00
[Compact]
public class Font : Object {
2018-01-08 23:33:13 +03:00
2018-01-19 19:56:10 +03:00
/**
2018-01-20 13:11:17 +03:00
* A font family name, encoded in UTF-8.
2018-01-19 19:56:10 +03:00
*/
2018-01-22 12:28:01 +03:00
public virtual string family { get; set; }
2018-01-19 19:56:10 +03:00
2018-01-20 13:11:17 +03:00
/**
* The new font size, in user space units.
*/
2018-01-22 12:28:01 +03:00
public virtual double size { get; set; }
2018-01-20 12:43:02 +03:00
2018-01-20 13:11:17 +03:00
/**
* The slant for the font.
*/
2018-01-22 12:28:01 +03:00
public virtual Cairo.FontSlant slant { get; set; }
2018-01-19 19:56:10 +03:00
2018-01-20 13:11:17 +03:00
/**
* The weight for the font.
*/
2018-01-22 12:28:01 +03:00
public virtual Cairo.FontWeight weight { get; set; }
2018-01-08 23:33:13 +03:00
2018-01-20 13:11:17 +03:00
/**
2018-01-20 13:27:10 +03:00
* Font/Text orientation.
2018-01-20 13:11:17 +03:00
*/
2018-01-22 12:28:01 +03:00
public virtual Gtk.Orientation orient { get; set; }
2018-01-19 19:56:10 +03:00
2018-01-22 15:03:10 +03:00
/**
* Vertical spacing.
*/
public double vspacing = 4;
/**
* Horizontal spacing.
*/
public double hspacing = 4;
/**
* Both vertical & horizontal spacing (set only).
*/
public virtual double spacing {
protected get {
return 0;
}
set {
vspacing = hspacing = value;
}
default = 4;
}
2018-01-20 13:11:17 +03:00
/**
* Constructs a new ``Font``.
* @param family a font family name, encoded in UTF-8.
* @param size the new font size, in user space units.
* @param slant the slant for the font.
* @param weight the weight for the font.
2018-01-20 13:27:10 +03:00
* @param orient font/text orientation.
2018-01-20 13:11:17 +03:00
*/
public Font (string family = "Sans",
2018-01-21 18:41:41 +03:00
double size = 10,
Cairo.FontSlant slant = Cairo.FontSlant.NORMAL,
Cairo.FontWeight weight = Cairo.FontWeight.NORMAL,
2018-01-22 15:03:10 +03:00
Gtk.Orientation orient = Gtk.Orientation.HORIZONTAL,
double vspacing = 4,
double hspacing = 4
2018-01-20 13:11:17 +03:00
) {
this.family = family;
this.size = size;
this.slant = slant;
this.weight = weight;
2018-01-20 13:27:10 +03:00
this.orient = orient;
2018-01-08 23:33:13 +03:00
}
2018-01-21 18:41:41 +03:00
/**
* Gets a copy of the ``Font``.
*/
2018-01-22 12:28:01 +03:00
public virtual Font copy () {
2018-01-22 15:03:10 +03:00
var f = new Font(family, size, slant, weight, orient);
f.vspacing = vspacing;
f.hspacing = hspacing;
return f;
2018-01-21 18:41:41 +03:00
}
2018-01-08 23:33:13 +03:00
}
}