/* font.c generated by valac 0.56.0, the Vala compiler
 * generated from font.vala, do not modify */

#include "livechart.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <cairo-gobject.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>
#include <gobject/gvaluecollector.h>

#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _LiveChartParamSpecFont LiveChartParamSpecFont;

struct _LiveChartFontPrivate {
	guint8 _size;
	gchar* _face;
	cairo_font_slant_t _slant;
	cairo_font_weight_t _weight;
	GdkRGBA _color;
};

struct _LiveChartParamSpecFont {
	GParamSpec parent_instance;
};

static gint LiveChartFont_private_offset;
static gpointer live_chart_font_parent_class = NULL;

static void live_chart_font_finalize (LiveChartFont * obj);
static GType live_chart_font_get_type_once (void);

static inline gpointer
live_chart_font_get_instance_private (LiveChartFont* self)
{
	return G_STRUCT_MEMBER_P (self, LiveChartFont_private_offset);
}

LiveChartFont*
live_chart_font_construct (GType object_type)
{
	LiveChartFont* self = NULL;
	GdkRGBA _tmp0_ = {0};
#line 12 "../src/font.vala"
	self = (LiveChartFont*) g_type_create_instance (object_type);
#line 13 "../src/font.vala"
	live_chart_font_set_size (self, (guint8) 10);
#line 14 "../src/font.vala"
	live_chart_font_set_face (self, "Sans serif");
#line 15 "../src/font.vala"
	live_chart_font_set_slant (self, CAIRO_FONT_SLANT_NORMAL);
#line 16 "../src/font.vala"
	live_chart_font_set_weight (self, CAIRO_FONT_WEIGHT_NORMAL);
#line 17 "../src/font.vala"
	_tmp0_.red = 0.4;
#line 17 "../src/font.vala"
	_tmp0_.green = 0.4;
#line 17 "../src/font.vala"
	_tmp0_.blue = 0.4;
#line 17 "../src/font.vala"
	_tmp0_.alpha = 1.0;
#line 17 "../src/font.vala"
	live_chart_font_set_color (self, &_tmp0_);
#line 12 "../src/font.vala"
	return self;
#line 69 "font.c"
}

LiveChartFont*
live_chart_font_new (void)
{
#line 12 "../src/font.vala"
	return live_chart_font_construct (LIVE_CHART_TYPE_FONT);
#line 77 "font.c"
}

void
live_chart_font_configure (LiveChartFont* self,
                           cairo_t* ctx)
{
	const gchar* _tmp0_;
	cairo_font_slant_t _tmp1_;
	cairo_font_weight_t _tmp2_;
	guint8 _tmp3_;
	GdkRGBA _tmp4_;
	GdkRGBA _tmp5_;
	GdkRGBA _tmp6_;
	GdkRGBA _tmp7_;
#line 20 "../src/font.vala"
	g_return_if_fail (self != NULL);
#line 20 "../src/font.vala"
	g_return_if_fail (ctx != NULL);
#line 21 "../src/font.vala"
	_tmp0_ = self->priv->_face;
#line 21 "../src/font.vala"
	_tmp1_ = self->priv->_slant;
#line 21 "../src/font.vala"
	_tmp2_ = self->priv->_weight;
#line 21 "../src/font.vala"
	cairo_select_font_face (ctx, _tmp0_, _tmp1_, _tmp2_);
#line 22 "../src/font.vala"
	_tmp3_ = self->priv->_size;
#line 22 "../src/font.vala"
	cairo_set_font_size (ctx, (gdouble) _tmp3_);
#line 23 "../src/font.vala"
	_tmp4_ = self->priv->_color;
#line 23 "../src/font.vala"
	_tmp5_ = self->priv->_color;
#line 23 "../src/font.vala"
	_tmp6_ = self->priv->_color;
#line 23 "../src/font.vala"
	_tmp7_ = self->priv->_color;
#line 23 "../src/font.vala"
	cairo_set_source_rgba (ctx, _tmp4_.red, _tmp5_.green, _tmp6_.blue, _tmp7_.alpha);
#line 118 "font.c"
}

guint8
live_chart_font_get_size (LiveChartFont* self)
{
	guint8 result;
#line 6 "../src/font.vala"
	g_return_val_if_fail (self != NULL, 0U);
#line 6 "../src/font.vala"
	result = self->priv->_size;
#line 6 "../src/font.vala"
	return result;
#line 131 "font.c"
}

void
live_chart_font_set_size (LiveChartFont* self,
                          guint8 value)
{
#line 6 "../src/font.vala"
	g_return_if_fail (self != NULL);
#line 6 "../src/font.vala"
	self->priv->_size = value;
#line 142 "font.c"
}

const gchar*
live_chart_font_get_face (LiveChartFont* self)
{
	const gchar* result;
	const gchar* _tmp0_;
#line 7 "../src/font.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 7 "../src/font.vala"
	_tmp0_ = self->priv->_face;
#line 7 "../src/font.vala"
	result = _tmp0_;
#line 7 "../src/font.vala"
	return result;
#line 158 "font.c"
}

void
live_chart_font_set_face (LiveChartFont* self,
                          const gchar* value)
{
	gchar* _tmp0_;
#line 7 "../src/font.vala"
	g_return_if_fail (self != NULL);
#line 7 "../src/font.vala"
	_tmp0_ = g_strdup (value);
#line 7 "../src/font.vala"
	_g_free0 (self->priv->_face);
#line 7 "../src/font.vala"
	self->priv->_face = _tmp0_;
#line 174 "font.c"
}

cairo_font_slant_t
live_chart_font_get_slant (LiveChartFont* self)
{
	cairo_font_slant_t result;
#line 8 "../src/font.vala"
	g_return_val_if_fail (self != NULL, 0);
#line 8 "../src/font.vala"
	result = self->priv->_slant;
#line 8 "../src/font.vala"
	return result;
#line 187 "font.c"
}

void
live_chart_font_set_slant (LiveChartFont* self,
                           cairo_font_slant_t value)
{
#line 8 "../src/font.vala"
	g_return_if_fail (self != NULL);
#line 8 "../src/font.vala"
	self->priv->_slant = value;
#line 198 "font.c"
}

cairo_font_weight_t
live_chart_font_get_weight (LiveChartFont* self)
{
	cairo_font_weight_t result;
#line 9 "../src/font.vala"
	g_return_val_if_fail (self != NULL, 0);
#line 9 "../src/font.vala"
	result = self->priv->_weight;
#line 9 "../src/font.vala"
	return result;
#line 211 "font.c"
}

void
live_chart_font_set_weight (LiveChartFont* self,
                            cairo_font_weight_t value)
{
#line 9 "../src/font.vala"
	g_return_if_fail (self != NULL);
#line 9 "../src/font.vala"
	self->priv->_weight = value;
#line 222 "font.c"
}

void
live_chart_font_get_color (LiveChartFont* self,
                           GdkRGBA * result)
{
	GdkRGBA _tmp0_;
#line 10 "../src/font.vala"
	g_return_if_fail (self != NULL);
#line 10 "../src/font.vala"
	_tmp0_ = self->priv->_color;
#line 10 "../src/font.vala"
	*result = _tmp0_;
#line 10 "../src/font.vala"
	return;
#line 238 "font.c"
}

void
live_chart_font_set_color (LiveChartFont* self,
                           GdkRGBA * value)
{
	GdkRGBA _tmp0_;
#line 10 "../src/font.vala"
	g_return_if_fail (self != NULL);
#line 10 "../src/font.vala"
	_tmp0_ = *value;
#line 10 "../src/font.vala"
	self->priv->_color = _tmp0_;
#line 252 "font.c"
}

static void
live_chart_value_font_init (GValue* value)
{
#line 5 "../src/font.vala"
	value->data[0].v_pointer = NULL;
#line 260 "font.c"
}

static void
live_chart_value_font_free_value (GValue* value)
{
#line 5 "../src/font.vala"
	if (value->data[0].v_pointer) {
#line 5 "../src/font.vala"
		live_chart_font_unref (value->data[0].v_pointer);
#line 270 "font.c"
	}
}

static void
live_chart_value_font_copy_value (const GValue* src_value,
                                  GValue* dest_value)
{
#line 5 "../src/font.vala"
	if (src_value->data[0].v_pointer) {
#line 5 "../src/font.vala"
		dest_value->data[0].v_pointer = live_chart_font_ref (src_value->data[0].v_pointer);
#line 282 "font.c"
	} else {
#line 5 "../src/font.vala"
		dest_value->data[0].v_pointer = NULL;
#line 286 "font.c"
	}
}

static gpointer
live_chart_value_font_peek_pointer (const GValue* value)
{
#line 5 "../src/font.vala"
	return value->data[0].v_pointer;
#line 295 "font.c"
}

static gchar*
live_chart_value_font_collect_value (GValue* value,
                                     guint n_collect_values,
                                     GTypeCValue* collect_values,
                                     guint collect_flags)
{
#line 5 "../src/font.vala"
	if (collect_values[0].v_pointer) {
#line 306 "font.c"
		LiveChartFont * object;
		object = collect_values[0].v_pointer;
#line 5 "../src/font.vala"
		if (object->parent_instance.g_class == NULL) {
#line 5 "../src/font.vala"
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 313 "font.c"
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
#line 5 "../src/font.vala"
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
#line 317 "font.c"
		}
#line 5 "../src/font.vala"
		value->data[0].v_pointer = live_chart_font_ref (object);
#line 321 "font.c"
	} else {
#line 5 "../src/font.vala"
		value->data[0].v_pointer = NULL;
#line 325 "font.c"
	}
#line 5 "../src/font.vala"
	return NULL;
#line 329 "font.c"
}

static gchar*
live_chart_value_font_lcopy_value (const GValue* value,
                                   guint n_collect_values,
                                   GTypeCValue* collect_values,
                                   guint collect_flags)
{
	LiveChartFont ** object_p;
	object_p = collect_values[0].v_pointer;
#line 5 "../src/font.vala"
	if (!object_p) {
#line 5 "../src/font.vala"
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
#line 344 "font.c"
	}
#line 5 "../src/font.vala"
	if (!value->data[0].v_pointer) {
#line 5 "../src/font.vala"
		*object_p = NULL;
#line 350 "font.c"
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
#line 5 "../src/font.vala"
		*object_p = value->data[0].v_pointer;
#line 354 "font.c"
	} else {
#line 5 "../src/font.vala"
		*object_p = live_chart_font_ref (value->data[0].v_pointer);
#line 358 "font.c"
	}
#line 5 "../src/font.vala"
	return NULL;
#line 362 "font.c"
}

GParamSpec*
live_chart_param_spec_font (const gchar* name,
                            const gchar* nick,
                            const gchar* blurb,
                            GType object_type,
                            GParamFlags flags)
{
	LiveChartParamSpecFont* spec;
#line 5 "../src/font.vala"
	g_return_val_if_fail (g_type_is_a (object_type, LIVE_CHART_TYPE_FONT), NULL);
#line 5 "../src/font.vala"
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
#line 5 "../src/font.vala"
	G_PARAM_SPEC (spec)->value_type = object_type;
#line 5 "../src/font.vala"
	return G_PARAM_SPEC (spec);
#line 381 "font.c"
}

gpointer
live_chart_value_get_font (const GValue* value)
{
#line 5 "../src/font.vala"
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, LIVE_CHART_TYPE_FONT), NULL);
#line 5 "../src/font.vala"
	return value->data[0].v_pointer;
#line 391 "font.c"
}

void
live_chart_value_set_font (GValue* value,
                           gpointer v_object)
{
	LiveChartFont * old;
#line 5 "../src/font.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, LIVE_CHART_TYPE_FONT));
#line 5 "../src/font.vala"
	old = value->data[0].v_pointer;
#line 5 "../src/font.vala"
	if (v_object) {
#line 5 "../src/font.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, LIVE_CHART_TYPE_FONT));
#line 5 "../src/font.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 5 "../src/font.vala"
		value->data[0].v_pointer = v_object;
#line 5 "../src/font.vala"
		live_chart_font_ref (value->data[0].v_pointer);
#line 413 "font.c"
	} else {
#line 5 "../src/font.vala"
		value->data[0].v_pointer = NULL;
#line 417 "font.c"
	}
#line 5 "../src/font.vala"
	if (old) {
#line 5 "../src/font.vala"
		live_chart_font_unref (old);
#line 423 "font.c"
	}
}

void
live_chart_value_take_font (GValue* value,
                            gpointer v_object)
{
	LiveChartFont * old;
#line 5 "../src/font.vala"
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, LIVE_CHART_TYPE_FONT));
#line 5 "../src/font.vala"
	old = value->data[0].v_pointer;
#line 5 "../src/font.vala"
	if (v_object) {
#line 5 "../src/font.vala"
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, LIVE_CHART_TYPE_FONT));
#line 5 "../src/font.vala"
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
#line 5 "../src/font.vala"
		value->data[0].v_pointer = v_object;
#line 444 "font.c"
	} else {
#line 5 "../src/font.vala"
		value->data[0].v_pointer = NULL;
#line 448 "font.c"
	}
#line 5 "../src/font.vala"
	if (old) {
#line 5 "../src/font.vala"
		live_chart_font_unref (old);
#line 454 "font.c"
	}
}

static void
live_chart_font_class_init (LiveChartFontClass * klass,
                            gpointer klass_data)
{
#line 5 "../src/font.vala"
	live_chart_font_parent_class = g_type_class_peek_parent (klass);
#line 5 "../src/font.vala"
	((LiveChartFontClass *) klass)->finalize = live_chart_font_finalize;
#line 5 "../src/font.vala"
	g_type_class_adjust_private_offset (klass, &LiveChartFont_private_offset);
#line 468 "font.c"
}

static void
live_chart_font_instance_init (LiveChartFont * self,
                               gpointer klass)
{
#line 5 "../src/font.vala"
	self->priv = live_chart_font_get_instance_private (self);
#line 5 "../src/font.vala"
	self->ref_count = 1;
#line 479 "font.c"
}

static void
live_chart_font_finalize (LiveChartFont * obj)
{
	LiveChartFont * self;
#line 5 "../src/font.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_FONT, LiveChartFont);
#line 5 "../src/font.vala"
	g_signal_handlers_destroy (self);
#line 7 "../src/font.vala"
	_g_free0 (self->priv->_face);
#line 492 "font.c"
}

static GType
live_chart_font_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { live_chart_value_font_init, live_chart_value_font_free_value, live_chart_value_font_copy_value, live_chart_value_font_peek_pointer, "p", live_chart_value_font_collect_value, "p", live_chart_value_font_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (LiveChartFontClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_font_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartFont), 0, (GInstanceInitFunc) live_chart_font_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType live_chart_font_type_id;
	live_chart_font_type_id = g_type_register_fundamental (g_type_fundamental_next (), "LiveChartFont", &g_define_type_info, &g_define_type_fundamental_info, 0);
	LiveChartFont_private_offset = g_type_add_instance_private (live_chart_font_type_id, sizeof (LiveChartFontPrivate));
	return live_chart_font_type_id;
}

GType
live_chart_font_get_type (void)
{
	static volatile gsize live_chart_font_type_id__once = 0;
	if (g_once_init_enter (&live_chart_font_type_id__once)) {
		GType live_chart_font_type_id;
		live_chart_font_type_id = live_chart_font_get_type_once ();
		g_once_init_leave (&live_chart_font_type_id__once, live_chart_font_type_id);
	}
	return live_chart_font_type_id__once;
}

gpointer
live_chart_font_ref (gpointer instance)
{
	LiveChartFont * self;
	self = instance;
#line 5 "../src/font.vala"
	g_atomic_int_inc (&self->ref_count);
#line 5 "../src/font.vala"
	return instance;
#line 528 "font.c"
}

void
live_chart_font_unref (gpointer instance)
{
	LiveChartFont * self;
	self = instance;
#line 5 "../src/font.vala"
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
#line 5 "../src/font.vala"
		LIVE_CHART_FONT_GET_CLASS (self)->finalize (self);
#line 5 "../src/font.vala"
		g_type_free_instance ((GTypeInstance *) self);
#line 542 "font.c"
	}
}

