// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Pango {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class Global {

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_pango_bidi_type_for_unichar(uint ch);
		static d_pango_bidi_type_for_unichar pango_bidi_type_for_unichar = FuncLoader.LoadFunction<d_pango_bidi_type_for_unichar>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_bidi_type_for_unichar"));

		public static Pango.BidiType BidiTypeForUnichar(char ch) {
			int raw_ret = pango_bidi_type_for_unichar(GLib.Marshaller.CharToGUnichar (ch));
			Pango.BidiType ret = (Pango.BidiType) raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_pango_extents_to_pixels(IntPtr inclusive, IntPtr nearest);
		static d_pango_extents_to_pixels pango_extents_to_pixels = FuncLoader.LoadFunction<d_pango_extents_to_pixels>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_extents_to_pixels"));

		public static void ExtentsToPixels(ref Pango.Rectangle inclusive, ref Pango.Rectangle nearest) {
			IntPtr native_inclusive = GLib.Marshaller.StructureToPtrAlloc (inclusive);
			IntPtr native_nearest = GLib.Marshaller.StructureToPtrAlloc (nearest);
			pango_extents_to_pixels(native_inclusive, native_nearest);
			inclusive = Pango.Rectangle.New (native_inclusive);
			Marshal.FreeHGlobal (native_inclusive);
			nearest = Pango.Rectangle.New (native_nearest);
			Marshal.FreeHGlobal (native_nearest);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_pango_find_base_dir(IntPtr text, int length);
		static d_pango_find_base_dir pango_find_base_dir = FuncLoader.LoadFunction<d_pango_find_base_dir>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_find_base_dir"));

		public static Pango.Direction FindBaseDir(string text) {
			IntPtr native_text = GLib.Marshaller.StringToPtrGStrdup (text);
			int raw_ret = pango_find_base_dir(native_text, System.Text.Encoding.UTF8.GetByteCount (text));
			Pango.Direction ret = (Pango.Direction) raw_ret;
			GLib.Marshaller.Free (native_text);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_pango_find_paragraph_boundary(IntPtr text, int length, out int paragraph_delimiter_index, out int next_paragraph_start);
		static d_pango_find_paragraph_boundary pango_find_paragraph_boundary = FuncLoader.LoadFunction<d_pango_find_paragraph_boundary>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_find_paragraph_boundary"));

		public static void FindParagraphBoundary(string text, out int paragraph_delimiter_index, out int next_paragraph_start) {
			IntPtr native_text = GLib.Marshaller.StringToPtrGStrdup (text);
			pango_find_paragraph_boundary(native_text, System.Text.Encoding.UTF8.GetByteCount (text), out paragraph_delimiter_index, out next_paragraph_start);
			GLib.Marshaller.Free (native_text);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_pango_get_log_attrs(IntPtr text, int length, int level, IntPtr language, IntPtr log_attrs, int attrs_len);
		static d_pango_get_log_attrs pango_get_log_attrs = FuncLoader.LoadFunction<d_pango_get_log_attrs>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_get_log_attrs"));

		public static void GetLogAttrs(string text, int level, Pango.Language language, Pango.LogAttr log_attrs, int attrs_len) {
			IntPtr native_text = GLib.Marshaller.StringToPtrGStrdup (text);
			IntPtr native_log_attrs = GLib.Marshaller.StructureToPtrAlloc (log_attrs);
			pango_get_log_attrs(native_text, System.Text.Encoding.UTF8.GetByteCount (text), level, language == null ? IntPtr.Zero : language.Handle, native_log_attrs, attrs_len);
			GLib.Marshaller.Free (native_text);
			Marshal.FreeHGlobal (native_log_attrs);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_pango_gravity_get_for_matrix(IntPtr matrix);
		static d_pango_gravity_get_for_matrix pango_gravity_get_for_matrix = FuncLoader.LoadFunction<d_pango_gravity_get_for_matrix>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_gravity_get_for_matrix"));

		public static Pango.Gravity GravityGetForMatrix(Pango.Matrix matrix) {
			IntPtr native_matrix = GLib.Marshaller.StructureToPtrAlloc (matrix);
			int raw_ret = pango_gravity_get_for_matrix(native_matrix);
			Pango.Gravity ret = (Pango.Gravity) raw_ret;
			Marshal.FreeHGlobal (native_matrix);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_pango_gravity_get_for_script(int script, int base_gravity, int hint);
		static d_pango_gravity_get_for_script pango_gravity_get_for_script = FuncLoader.LoadFunction<d_pango_gravity_get_for_script>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_gravity_get_for_script"));

		public static Pango.Gravity GravityGetForScript(Pango.Script script, Pango.Gravity base_gravity, Pango.GravityHint hint) {
			int raw_ret = pango_gravity_get_for_script((int) script, (int) base_gravity, (int) hint);
			Pango.Gravity ret = (Pango.Gravity) raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_pango_gravity_get_for_script_and_width(int script, bool wide, int base_gravity, int hint);
		static d_pango_gravity_get_for_script_and_width pango_gravity_get_for_script_and_width = FuncLoader.LoadFunction<d_pango_gravity_get_for_script_and_width>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_gravity_get_for_script_and_width"));

		public static Pango.Gravity GravityGetForScriptAndWidth(Pango.Script script, bool wide, Pango.Gravity base_gravity, Pango.GravityHint hint) {
			int raw_ret = pango_gravity_get_for_script_and_width((int) script, wide, (int) base_gravity, (int) hint);
			Pango.Gravity ret = (Pango.Gravity) raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate double d_pango_gravity_to_rotation(int gravity);
		static d_pango_gravity_to_rotation pango_gravity_to_rotation = FuncLoader.LoadFunction<d_pango_gravity_to_rotation>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_gravity_to_rotation"));

		public static double GravityToRotation(Pango.Gravity gravity) {
			double raw_ret = pango_gravity_to_rotation((int) gravity);
			double ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_pango_is_zero_width(uint ch);
		static d_pango_is_zero_width pango_is_zero_width = FuncLoader.LoadFunction<d_pango_is_zero_width>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_is_zero_width"));

		public static bool IsZeroWidth(char ch) {
			bool raw_ret = pango_is_zero_width(GLib.Marshaller.CharToGUnichar (ch));
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_pango_itemize_with_base_dir(IntPtr context, int base_dir, IntPtr text, int start_index, int length, IntPtr attrs, IntPtr cached_iter);
		static d_pango_itemize_with_base_dir pango_itemize_with_base_dir = FuncLoader.LoadFunction<d_pango_itemize_with_base_dir>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_itemize_with_base_dir"));

		public static Pango.Item[] ItemizeWithBaseDir(Pango.Context context, Pango.Direction base_dir, string text, int start_index, int length, Pango.AttrList attrs, Pango.AttrIterator cached_iter) {
			IntPtr native_text = GLib.Marshaller.StringToPtrGStrdup (text);
			IntPtr raw_ret = pango_itemize_with_base_dir(context == null ? IntPtr.Zero : context.Handle, (int) base_dir, native_text, start_index, length, attrs == null ? IntPtr.Zero : attrs.Handle, cached_iter == null ? IntPtr.Zero : cached_iter.Handle);
			Pango.Item[] ret = GLib.Marshaller.ListPtrToArray<Pango.Item, Pango.Item> (raw_ret, true, true);
			GLib.Marshaller.Free (native_text);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_pango_parse_enum(IntPtr type, IntPtr str, out int value, bool warn, IntPtr possible_values);
		static d_pango_parse_enum pango_parse_enum = FuncLoader.LoadFunction<d_pango_parse_enum>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_parse_enum"));

		[Obsolete]
		public static bool ParseEnum(GLib.GType type, string str, out int value, bool warn, string possible_values) {
			IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (str);
			bool raw_ret = pango_parse_enum(type.Val, native_str, out value, warn, GLib.Marshaller.StringToPtrGStrdup(possible_values));
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_str);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_pango_parse_stretch(IntPtr str, out int stretch, bool warn);
		static d_pango_parse_stretch pango_parse_stretch = FuncLoader.LoadFunction<d_pango_parse_stretch>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_parse_stretch"));

		public static bool ParseStretch(string str, out Pango.Stretch stretch, bool warn) {
			IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (str);
			int native_stretch;
			bool raw_ret = pango_parse_stretch(native_str, out native_stretch, warn);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_str);
			stretch = (Pango.Stretch) native_stretch;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_pango_parse_style(IntPtr str, out int style, bool warn);
		static d_pango_parse_style pango_parse_style = FuncLoader.LoadFunction<d_pango_parse_style>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_parse_style"));

		public static bool ParseStyle(string str, out Pango.Style style, bool warn) {
			IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (str);
			int native_style;
			bool raw_ret = pango_parse_style(native_str, out native_style, warn);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_str);
			style = (Pango.Style) native_style;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_pango_parse_variant(IntPtr str, out int variant, bool warn);
		static d_pango_parse_variant pango_parse_variant = FuncLoader.LoadFunction<d_pango_parse_variant>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_parse_variant"));

		public static bool ParseVariant(string str, out Pango.Variant variant, bool warn) {
			IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (str);
			int native_variant;
			bool raw_ret = pango_parse_variant(native_str, out native_variant, warn);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_str);
			variant = (Pango.Variant) native_variant;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_pango_parse_weight(IntPtr str, out int weight, bool warn);
		static d_pango_parse_weight pango_parse_weight = FuncLoader.LoadFunction<d_pango_parse_weight>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_parse_weight"));

		public static bool ParseWeight(string str, out Pango.Weight weight, bool warn) {
			IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (str);
			int native_weight;
			bool raw_ret = pango_parse_weight(native_str, out native_weight, warn);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_str);
			weight = (Pango.Weight) native_weight;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_pango_quantize_line_geometry(out int thickness, out int position);
		static d_pango_quantize_line_geometry pango_quantize_line_geometry = FuncLoader.LoadFunction<d_pango_quantize_line_geometry>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_quantize_line_geometry"));

		public static void QuantizeLineGeometry(out int thickness, out int position) {
			pango_quantize_line_geometry(out thickness, out position);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_pango_scan_int(ref IntPtr pos, out int out_param);
		static d_pango_scan_int pango_scan_int = FuncLoader.LoadFunction<d_pango_scan_int>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_scan_int"));

		[Obsolete]
		public static bool ScanInt(ref string pos, out int out_param) {
			IntPtr native_pos = GLib.Marshaller.StringToPtrGStrdup (pos);
			bool raw_ret = pango_scan_int(ref native_pos, out out_param);
			bool ret = raw_ret;
			pos = GLib.Marshaller.Utf8PtrToString (native_pos);
			GLib.Marshaller.Free (native_pos);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_pango_script_for_unichar(uint ch);
		static d_pango_script_for_unichar pango_script_for_unichar = FuncLoader.LoadFunction<d_pango_script_for_unichar>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_script_for_unichar"));

		public static Pango.Script ScriptForUnichar(char ch) {
			int raw_ret = pango_script_for_unichar(GLib.Marshaller.CharToGUnichar (ch));
			Pango.Script ret = (Pango.Script) raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_pango_script_get_sample_language(int script);
		static d_pango_script_get_sample_language pango_script_get_sample_language = FuncLoader.LoadFunction<d_pango_script_get_sample_language>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_script_get_sample_language"));

		public static Pango.Language ScriptGetSampleLanguage(Pango.Script script) {
			IntPtr raw_ret = pango_script_get_sample_language((int) script);
			Pango.Language ret = raw_ret == IntPtr.Zero ? null : (Pango.Language) GLib.Opaque.GetOpaque (raw_ret, typeof (Pango.Language), false);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_pango_shape_full(IntPtr item_text, int item_length, IntPtr paragraph_text, int paragraph_length, IntPtr analysis, IntPtr glyphs);
		static d_pango_shape_full pango_shape_full = FuncLoader.LoadFunction<d_pango_shape_full>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_shape_full"));

		public static void ShapeFull(string item_text, string paragraph_text, Pango.Analysis analysis, Pango.GlyphString glyphs) {
			IntPtr native_item_text = GLib.Marshaller.StringToPtrGStrdup (item_text);
			IntPtr native_paragraph_text = GLib.Marshaller.StringToPtrGStrdup (paragraph_text);
			IntPtr native_analysis = GLib.Marshaller.StructureToPtrAlloc (analysis);
			pango_shape_full(native_item_text, System.Text.Encoding.UTF8.GetByteCount (item_text), native_paragraph_text, System.Text.Encoding.UTF8.GetByteCount (paragraph_text), native_analysis, glyphs == null ? IntPtr.Zero : glyphs.Handle);
			GLib.Marshaller.Free (native_item_text);
			GLib.Marshaller.Free (native_paragraph_text);
			Marshal.FreeHGlobal (native_analysis);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_pango_skip_space(ref IntPtr pos);
		static d_pango_skip_space pango_skip_space = FuncLoader.LoadFunction<d_pango_skip_space>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_skip_space"));

		[Obsolete]
		public static bool SkipSpace(ref string pos) {
			IntPtr native_pos = GLib.Marshaller.StringToPtrGStrdup (pos);
			bool raw_ret = pango_skip_space(ref native_pos);
			bool ret = raw_ret;
			pos = GLib.Marshaller.Utf8PtrToString (native_pos);
			GLib.Marshaller.Free (native_pos);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_pango_split_file_list(IntPtr str);
		static d_pango_split_file_list pango_split_file_list = FuncLoader.LoadFunction<d_pango_split_file_list>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_split_file_list"));

		[Obsolete]
		public static string SplitFileList(string str) {
			IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (str);
			IntPtr raw_ret = pango_split_file_list(native_str);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			GLib.Marshaller.Free (native_str);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_pango_trim_string(IntPtr str);
		static d_pango_trim_string pango_trim_string = FuncLoader.LoadFunction<d_pango_trim_string>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_trim_string"));

		[Obsolete]
		public static string TrimString(string str) {
			IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (str);
			IntPtr raw_ret = pango_trim_string(native_str);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			GLib.Marshaller.Free (native_str);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_pango_unichar_direction(uint ch);
		static d_pango_unichar_direction pango_unichar_direction = FuncLoader.LoadFunction<d_pango_unichar_direction>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_unichar_direction"));

		public static Pango.Direction UnicharDirection(char ch) {
			int raw_ret = pango_unichar_direction(GLib.Marshaller.CharToGUnichar (ch));
			Pango.Direction ret = (Pango.Direction) raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_pango_version_check(int required_major, int required_minor, int required_micro);
		static d_pango_version_check pango_version_check = FuncLoader.LoadFunction<d_pango_version_check>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_version_check"));

		public static string VersionCheck(int required_major, int required_minor, int required_micro) {
			IntPtr raw_ret = pango_version_check(required_major, required_minor, required_micro);
			string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_pango_version_string();
		static d_pango_version_string pango_version_string = FuncLoader.LoadFunction<d_pango_version_string>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_version_string"));

		public static string VersionString() {
			IntPtr raw_ret = pango_version_string();
			string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
			return ret;
		}

#endregion
	}
}
