diff --git a/src/Chart.vala b/src/Chart.vala index afc0634..e453ba4 100644 --- a/src/Chart.vala +++ b/src/Chart.vala @@ -303,7 +303,7 @@ namespace CairoChart { } protected virtual void rot_axes_titles () { foreach (var s in series) - s.axis_y.title.style.direct = FontDirect.VERTICAL; + s.axis_y.title.style.orient = Gtk.Orientation.VERTICAL; } protected virtual void eval_plarea () { diff --git a/src/Font.vala b/src/Font.vala index 307ec36..2f85e5b 100644 --- a/src/Font.vala +++ b/src/Font.vala @@ -1,21 +1,5 @@ namespace CairoChart { - /** - * ``Font`` direction. - */ - public enum FontDirect { - - /** - * Horizontal font/text direction. - */ - HORIZONTAL = 0, - - /** - * Vertical font/text direction. - */ - VERTICAL - } - /** * ``Font`` style. */ @@ -42,9 +26,9 @@ namespace CairoChart { Cairo.FontWeight weight; /** - * Font/Text direction. + * Font/Text orientation. */ - FontDirect direct; + Gtk.Orientation orient; /** * Constructs a new ``Font``. @@ -52,19 +36,19 @@ namespace CairoChart { * @param size the new font size, in user space units. * @param slant the slant for the font. * @param weight the weight for the font. - * @param direct font/text direction. + * @param orient font/text orientation. */ public Font (string family = "Sans", double size = 10, Cairo.FontSlant slant = Cairo.FontSlant.NORMAL, Cairo.FontWeight weight = Cairo.FontWeight.NORMAL, - FontDirect direct = FontDirect.HORIZONTAL + Gtk.Orientation orient = Gtk.Orientation.HORIZONTAL ) { this.family = family; this.size = size; this.slant = slant; this.weight = weight; - this.direct = direct; + this.orient = orient; } } } diff --git a/src/Text.vala b/src/Text.vala index 4e1270e..612ea83 100644 --- a/src/Text.vala +++ b/src/Text.vala @@ -25,18 +25,18 @@ namespace CairoChart { public virtual double get_width (Cairo.Context ctx) { var extents = get_extents (ctx); - switch (style.direct) { - case FontDirect.HORIZONTAL: return extents.width; - case FontDirect.VERTICAL: return extents.height; + switch (style.orient) { + case Gtk.Orientation.HORIZONTAL: return extents.width; + case Gtk.Orientation.VERTICAL: return extents.height; default: return 0.0; } } public virtual double get_height (Cairo.Context ctx) { var extents = get_extents (ctx); - switch (style.direct) { - case FontDirect.HORIZONTAL: return extents.height; - case FontDirect.VERTICAL: return extents.width; + switch (style.orient) { + case Gtk.Orientation.HORIZONTAL: return extents.height; + case Gtk.Orientation.VERTICAL: return extents.width; default: return 0.0; } } @@ -49,12 +49,12 @@ namespace CairoChart { public virtual Size get_size (Cairo.Context ctx) { var sz = Size(); var extents = get_extents (ctx); - switch (style.direct) { - case FontDirect.HORIZONTAL: + switch (style.orient) { + case Gtk.Orientation.HORIZONTAL: sz.width = extents.width + extents.x_bearing; sz.height = extents.height; break; - case FontDirect.VERTICAL: + case Gtk.Orientation.VERTICAL: sz.width = extents.height; // + extents.x_bearing ? sz.height = extents.width; // +- extents.y_bearing ? break; @@ -67,7 +67,7 @@ namespace CairoChart { style.slant, style.weight); ctx.set_font_size(style.size); - if (style.direct == FontDirect.VERTICAL) { + if (style.orient == Gtk.Orientation.VERTICAL) { ctx.rotate(- GLib.Math.PI / 2.0); ctx.show_text(text); ctx.rotate(GLib.Math.PI / 2.0);