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

/*
Copyright (C) 2012 2013 2014 2015 Johan Mattsson

This library is free software; you can redistribute it and/or modify 
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation; either version 3 of the 
License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but 
WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
Lesser General Public License for more details.
*/

#include "birdfont.h"
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	BIRD_FONT_GSUB_TABLE_0_PROPERTY,
	BIRD_FONT_GSUB_TABLE_NUM_PROPERTIES
};
static GParamSpec* bird_font_gsub_table_properties[BIRD_FONT_GSUB_TABLE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

struct _BirdFontGsubTablePrivate {
	BirdFontGlyfTable* glyf_table;
};

static gint BirdFontGsubTable_private_offset;
static gpointer bird_font_gsub_table_parent_class = NULL;

static void bird_font_gsub_table_real_parse (BirdFontOtfTable* base,
                                      BirdFontFontData* dis,
                                      GError** error);
static void bird_font_gsub_table_finalize (GObject * obj);
static GType bird_font_gsub_table_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
bird_font_gsub_table_get_instance_private (BirdFontGsubTable* self)
{
	return G_STRUCT_MEMBER_P (self, BirdFontGsubTable_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

BirdFontGsubTable*
bird_font_gsub_table_construct (GType object_type,
                                BirdFontGlyfTable* glyf_table)
{
	BirdFontGsubTable * self = NULL;
	BirdFontGlyfTable* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (glyf_table != NULL, NULL);
	self = (BirdFontGsubTable*) bird_font_otf_table_construct (object_type);
	_tmp0_ = _g_object_ref0 (glyf_table);
	_g_object_unref0 (self->priv->glyf_table);
	self->priv->glyf_table = _tmp0_;
	_tmp1_ = g_strdup ("GSUB");
	_g_free0 (((BirdFontOtfTable*) self)->id);
	((BirdFontOtfTable*) self)->id = _tmp1_;
	return self;
}

BirdFontGsubTable*
bird_font_gsub_table_new (BirdFontGlyfTable* glyf_table)
{
	return bird_font_gsub_table_construct (BIRD_FONT_TYPE_GSUB_TABLE, glyf_table);
}

static void
bird_font_gsub_table_real_parse (BirdFontOtfTable* base,
                                 BirdFontFontData* dis,
                                 GError** error)
{
	BirdFontGsubTable * self;
	self = (BirdFontGsubTable*) base;
	g_return_if_fail (dis != NULL);
}

void
bird_font_gsub_table_process (BirdFontGsubTable* self,
                              GError** error)
{
	BirdFontFontData* fd = NULL;
	BirdFontFontData* _tmp0_;
	BirdFontCligFeature* clig_feature = NULL;
	BirdFontGlyfTable* _tmp1_;
	BirdFontCligFeature* _tmp2_;
	BirdFontLookups* lookups = NULL;
	BirdFontLookups* _tmp3_;
	BirdFontFeatureList* features = NULL;
	BirdFontFeatureList* _tmp4_;
	gboolean _tmp5_ = FALSE;
	BirdFontCligFeature* _tmp6_;
	BirdFontContextualLigatureCollection* _tmp7_;
	gboolean has_clig = FALSE;
	BirdFontFeatureList* _tmp22_;
	BirdFontLookups* _tmp23_;
	BirdFontFeatureList* _tmp24_;
	BirdFontLookups* _tmp25_;
	BirdFontFeatureList* _tmp26_;
	BirdFontLookups* _tmp27_;
	BirdFontFeatureList* _tmp28_;
	BirdFontLookups* _tmp29_;
	BirdFontFontData* feature_tags = NULL;
	BirdFontFeatureList* _tmp30_;
	BirdFontFontData* _tmp31_;
	guint feature_list_offset = 0U;
	BirdFontFeatureList* _tmp32_;
	GeeArrayList* _tmp33_;
	gint _tmp34_;
	gint _tmp35_;
	guint lookup_list_offset = 0U;
	BirdFontFontData* _tmp36_;
	BirdFontFontData* _tmp37_;
	BirdFontFontData* _tmp38_;
	BirdFontFontData* _tmp39_;
	BirdFontFontData* _tmp40_;
	BirdFontFontData* _tmp41_;
	BirdFontFontData* _tmp42_;
	BirdFontFontData* _tmp43_;
	BirdFontFontData* _tmp44_;
	BirdFontFontData* _tmp45_;
	BirdFontFontData* _tmp46_;
	BirdFontFontData* _tmp47_;
	BirdFontFontData* _tmp48_;
	BirdFontFeatureList* _tmp49_;
	GeeArrayList* _tmp50_;
	gint _tmp51_;
	gint _tmp52_;
	BirdFontFontData* _tmp60_;
	BirdFontFontData* _tmp61_;
	BirdFontFontData* _tmp62_;
	BirdFontFontData* lookup_list = NULL;
	BirdFontLookups* _tmp70_;
	BirdFontFontData* _tmp71_;
	BirdFontFontData* _tmp72_;
	BirdFontFontData* _tmp73_;
	BirdFontFontData* _tmp74_;
	BirdFontFontData* _tmp75_;
	BirdFontFontData* _tmp76_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = bird_font_font_data_new ((guint32) 1024);
	_g_object_unref0 (fd);
	fd = _tmp0_;
	_tmp1_ = self->priv->glyf_table;
	_tmp2_ = bird_font_clig_feature_new (_tmp1_, &_inner_error0_);
	clig_feature = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		return;
	}
	_tmp3_ = bird_font_lookups_new ();
	lookups = _tmp3_;
	_tmp4_ = bird_font_feature_list_new ();
	features = _tmp4_;
	_tmp6_ = clig_feature;
	_tmp7_ = _tmp6_->contextual;
	if (bird_font_contextual_ligature_collection_has_ligatures (_tmp7_)) {
		_tmp5_ = TRUE;
	} else {
		BirdFontCligFeature* _tmp8_;
		_tmp8_ = clig_feature;
		_tmp5_ = bird_font_clig_feature_has_regular_ligatures (_tmp8_);
	}
	has_clig = _tmp5_;
	if (has_clig) {
		BirdFontLookups* clig_lookups = NULL;
		BirdFontCligFeature* _tmp9_;
		BirdFontLookups* _tmp10_;
		BirdFontFeature* clig_feature_lookup = NULL;
		BirdFontLookups* _tmp11_;
		BirdFontFeature* _tmp12_;
		BirdFontCligFeature* _tmp13_;
		BirdFontContextualLigatureCollection* _tmp14_;
		BirdFontCligFeature* _tmp16_;
		BirdFontFeatureList* _tmp18_;
		BirdFontFeature* _tmp19_;
		BirdFontLookups* _tmp20_;
		BirdFontLookups* _tmp21_;
		_tmp9_ = clig_feature;
		_tmp10_ = bird_font_clig_feature_get_lookups (_tmp9_);
		clig_lookups = _tmp10_;
		_tmp11_ = lookups;
		_tmp12_ = bird_font_feature_new ("clig", _tmp11_);
		clig_feature_lookup = _tmp12_;
		_tmp13_ = clig_feature;
		_tmp14_ = _tmp13_->contextual;
		if (bird_font_contextual_ligature_collection_has_ligatures (_tmp14_)) {
			BirdFontFeature* _tmp15_;
			_tmp15_ = clig_feature_lookup;
			bird_font_feature_add_feature_lookup (_tmp15_, "chain context");
		}
		_tmp16_ = clig_feature;
		if (bird_font_clig_feature_has_regular_ligatures (_tmp16_)) {
			BirdFontFeature* _tmp17_;
			_tmp17_ = clig_feature_lookup;
			bird_font_feature_add_feature_lookup (_tmp17_, "ligatures");
		}
		_tmp18_ = features;
		_tmp19_ = clig_feature_lookup;
		bird_font_feature_list_add (_tmp18_, _tmp19_);
		_tmp20_ = lookups;
		_tmp21_ = clig_lookups;
		bird_font_lookups_append (_tmp20_, _tmp21_);
		_g_object_unref0 (clig_feature_lookup);
		_g_object_unref0 (clig_lookups);
	}
	_tmp22_ = features;
	_tmp23_ = lookups;
	bird_font_gsub_table_add_alternate_table (self, _tmp22_, _tmp23_, "swsh", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp24_ = features;
	_tmp25_ = lookups;
	bird_font_gsub_table_add_alternate_table (self, _tmp24_, _tmp25_, "salt", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp26_ = features;
	_tmp27_ = lookups;
	bird_font_gsub_table_add_alternate_table (self, _tmp26_, _tmp27_, "c2sc", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp28_ = features;
	_tmp29_ = lookups;
	bird_font_gsub_table_add_alternate_table (self, _tmp28_, _tmp29_, "smcp", &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp30_ = features;
	_tmp31_ = bird_font_feature_list_generate_feature_tags (_tmp30_, &_inner_error0_);
	feature_tags = _tmp31_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp32_ = features;
	_tmp33_ = _tmp32_->features;
	_tmp34_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp33_);
	_tmp35_ = _tmp34_;
	feature_list_offset = (guint) (28 + (2 * _tmp35_));
	_tmp36_ = feature_tags;
	lookup_list_offset = feature_list_offset + bird_font_font_data_length_with_padding (_tmp36_);
	_tmp37_ = fd;
	bird_font_font_data_add_ulong (_tmp37_, (guint32) 0x00010000, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp38_ = fd;
	bird_font_font_data_add_ushort (_tmp38_, (guint16) 10, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp39_ = fd;
	bird_font_font_data_add_ushort (_tmp39_, (guint16) feature_list_offset, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp40_ = fd;
	bird_font_font_data_add_ushort (_tmp40_, (guint16) lookup_list_offset, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp41_ = fd;
	bird_font_font_data_add_ushort (_tmp41_, (guint16) 1, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp42_ = fd;
	bird_font_font_data_add_tag (_tmp42_, "DFLT");
	_tmp43_ = fd;
	bird_font_font_data_add_ushort (_tmp43_, (guint16) 8, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp44_ = fd;
	bird_font_font_data_add_ushort (_tmp44_, (guint16) 4, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp45_ = fd;
	bird_font_font_data_add_ushort (_tmp45_, (guint16) 0, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp46_ = fd;
	bird_font_font_data_add_ushort (_tmp46_, (guint16) 0, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp47_ = fd;
	bird_font_font_data_add_ushort (_tmp47_, (guint16) 0xFFFF, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp48_ = fd;
	_tmp49_ = features;
	_tmp50_ = _tmp49_->features;
	_tmp51_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp50_);
	_tmp52_ = _tmp51_;
	bird_font_font_data_add_ushort (_tmp48_, (guint16) _tmp52_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp53_ = FALSE;
			_tmp53_ = TRUE;
			while (TRUE) {
				BirdFontFeatureList* _tmp55_;
				GeeArrayList* _tmp56_;
				gint _tmp57_;
				gint _tmp58_;
				BirdFontFontData* _tmp59_;
				if (!_tmp53_) {
					gint _tmp54_;
					_tmp54_ = i;
					i = _tmp54_ + 1;
				}
				_tmp53_ = FALSE;
				_tmp55_ = features;
				_tmp56_ = _tmp55_->features;
				_tmp57_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp56_);
				_tmp58_ = _tmp57_;
				if (!(i < _tmp58_)) {
					break;
				}
				_tmp59_ = fd;
				bird_font_font_data_add_ushort (_tmp59_, (guint16) i, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					g_propagate_error (error, _inner_error0_);
					_g_object_unref0 (feature_tags);
					_g_object_unref0 (features);
					_g_object_unref0 (lookups);
					_g_object_unref0 (clig_feature);
					_g_object_unref0 (fd);
					return;
				}
			}
		}
	}
	_tmp60_ = fd;
	_tmp61_ = feature_tags;
	bird_font_font_data_append (_tmp60_, _tmp61_);
	_tmp62_ = fd;
	if (lookup_list_offset != bird_font_font_data_length_with_padding (_tmp62_)) {
		gchar* _tmp63_;
		gchar* _tmp64_;
		BirdFontFontData* _tmp65_;
		gchar* _tmp66_;
		gchar* _tmp67_;
		gchar* _tmp68_;
		gchar* _tmp69_;
		_tmp63_ = g_strdup_printf ("%u", lookup_list_offset);
		_tmp64_ = _tmp63_;
		_tmp65_ = fd;
		_tmp66_ = g_strdup_printf ("%u", bird_font_font_data_length_with_padding (_tmp65_));
		_tmp67_ = _tmp66_;
		_tmp68_ = g_strconcat ("Bad offset to lookup list: ", _tmp64_, " != ", _tmp67_, NULL);
		_tmp69_ = _tmp68_;
		g_warning ("GsubTable.vala:96: %s", _tmp69_);
		_g_free0 (_tmp69_);
		_g_free0 (_tmp67_);
		_g_free0 (_tmp64_);
	}
	_tmp70_ = lookups;
	_tmp71_ = bird_font_lookups_generate_lookup_list (_tmp70_, &_inner_error0_);
	lookup_list = _tmp71_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (feature_tags);
		_g_object_unref0 (features);
		_g_object_unref0 (lookups);
		_g_object_unref0 (clig_feature);
		_g_object_unref0 (fd);
		return;
	}
	_tmp72_ = fd;
	_tmp73_ = lookup_list;
	bird_font_font_data_append (_tmp72_, _tmp73_);
	_tmp74_ = fd;
	bird_font_font_data_pad (_tmp74_);
	_tmp75_ = fd;
	_tmp76_ = _g_object_ref0 (_tmp75_);
	_g_object_unref0 (((BirdFontOtfTable*) self)->font_data);
	((BirdFontOtfTable*) self)->font_data = _tmp76_;
	_g_object_unref0 (lookup_list);
	_g_object_unref0 (feature_tags);
	_g_object_unref0 (features);
	_g_object_unref0 (lookups);
	_g_object_unref0 (clig_feature);
	_g_object_unref0 (fd);
}

/** Add alterate substitutions to lookups and features. */
void
bird_font_gsub_table_add_alternate_table (BirdFontGsubTable* self,
                                          BirdFontFeatureList* features,
                                          BirdFontLookups* lookups,
                                          const gchar* tag,
                                          GError** error)
{
	BirdFontAlternateFeature* alt = NULL;
	BirdFontGlyfTable* _tmp0_;
	BirdFontAlternateFeature* _tmp1_;
	BirdFontAlternateFeature* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (features != NULL);
	g_return_if_fail (lookups != NULL);
	g_return_if_fail (tag != NULL);
	_tmp0_ = self->priv->glyf_table;
	_tmp1_ = bird_font_alternate_feature_new (_tmp0_, tag);
	alt = _tmp1_;
	_tmp2_ = alt;
	if (bird_font_alternate_feature_has_alternates (_tmp2_)) {
		BirdFontLookups* alt_lookup = NULL;
		BirdFontAlternateFeature* _tmp3_;
		BirdFontLookups* _tmp4_;
		BirdFontFeature* alt_feature_lookup = NULL;
		BirdFontFeature* _tmp5_;
		BirdFontFeature* _tmp6_;
		BirdFontFeature* _tmp7_;
		BirdFontLookups* _tmp8_;
		_tmp3_ = alt;
		_tmp4_ = bird_font_alternate_feature_get_lookups (_tmp3_, &_inner_error0_);
		alt_lookup = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (alt);
			return;
		}
		_tmp5_ = bird_font_feature_new (tag, lookups);
		alt_feature_lookup = _tmp5_;
		_tmp6_ = alt_feature_lookup;
		bird_font_feature_add_feature_lookup (_tmp6_, tag);
		_tmp7_ = alt_feature_lookup;
		bird_font_feature_list_add (features, _tmp7_);
		_tmp8_ = alt_lookup;
		bird_font_lookups_append (lookups, _tmp8_);
		_g_object_unref0 (alt_feature_lookup);
		_g_object_unref0 (alt_lookup);
	}
	_g_object_unref0 (alt);
}

static void
bird_font_gsub_table_class_init (BirdFontGsubTableClass * klass,
                                 gpointer klass_data)
{
	bird_font_gsub_table_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BirdFontGsubTable_private_offset);
	((BirdFontOtfTableClass *) klass)->parse = (void (*) (BirdFontOtfTable*, BirdFontFontData*, GError**)) bird_font_gsub_table_real_parse;
	G_OBJECT_CLASS (klass)->finalize = bird_font_gsub_table_finalize;
}

static void
bird_font_gsub_table_instance_init (BirdFontGsubTable * self,
                                    gpointer klass)
{
	self->priv = bird_font_gsub_table_get_instance_private (self);
}

static void
bird_font_gsub_table_finalize (GObject * obj)
{
	BirdFontGsubTable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_GSUB_TABLE, BirdFontGsubTable);
	_g_object_unref0 (self->priv->glyf_table);
	G_OBJECT_CLASS (bird_font_gsub_table_parent_class)->finalize (obj);
}

static GType
bird_font_gsub_table_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontGsubTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_gsub_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontGsubTable), 0, (GInstanceInitFunc) bird_font_gsub_table_instance_init, NULL };
	GType bird_font_gsub_table_type_id;
	bird_font_gsub_table_type_id = g_type_register_static (BIRD_FONT_TYPE_OTF_TABLE, "BirdFontGsubTable", &g_define_type_info, 0);
	BirdFontGsubTable_private_offset = g_type_add_instance_private (bird_font_gsub_table_type_id, sizeof (BirdFontGsubTablePrivate));
	return bird_font_gsub_table_type_id;
}

GType
bird_font_gsub_table_get_type (void)
{
	static volatile gsize bird_font_gsub_table_type_id__once = 0;
	if (g_once_init_enter (&bird_font_gsub_table_type_id__once)) {
		GType bird_font_gsub_table_type_id;
		bird_font_gsub_table_type_id = bird_font_gsub_table_get_type_once ();
		g_once_init_leave (&bird_font_gsub_table_type_id__once, bird_font_gsub_table_type_id);
	}
	return bird_font_gsub_table_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

