From 39f3bfdb23829a28de1f47736965c0b45d0f973d Mon Sep 17 00:00:00 2001 From: cra0zy Date: Mon, 12 Mar 2018 05:28:49 -0700 Subject: [PATCH] Fix getting Pango fonts --- Source/Libs/PangoSharp/Context.cs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Source/Libs/PangoSharp/Context.cs b/Source/Libs/PangoSharp/Context.cs index 9a46f013c..cf5dd552a 100644 --- a/Source/Libs/PangoSharp/Context.cs +++ b/Source/Libs/PangoSharp/Context.cs @@ -25,35 +25,25 @@ namespace Pango { public partial class Context { - delegate void d_pango_context_list_families2(IntPtr raw, out IntPtr families, out int n_families); - static d_pango_context_list_families2 pango_context_list_families2 = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_context_list_families")); + delegate void d_pango_context_list_families(IntPtr raw, out IntPtr families, out int n_families); + static d_pango_context_list_families pango_context_list_families = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_context_list_families")); public FontFamily [] Families { get { int count; IntPtr array_ptr; - pango_context_list_families2 (Handle, out array_ptr, out count); + pango_context_list_families (Handle, out array_ptr, out count); if (array_ptr == IntPtr.Zero) return new FontFamily [0]; FontFamily [] result = new FontFamily [count]; for (int i = 0; i < count; i++) { - IntPtr fam_ptr = Marshal.ReadIntPtr (array_ptr, i * IntPtr.Size); - result [i] = GLib.Object.GetObject (fam_ptr) as FontFamily; + IntPtr fam_ptr = Marshal.ReadIntPtr (array_ptr, i * IntPtr.Size); + result[i] = new FontFamily(fam_ptr); } GLib.Marshaller.Free (array_ptr); return result; } } - - delegate void d_pango_context_list_families(IntPtr raw, IntPtr families, out int n_families); - static d_pango_context_list_families pango_context_list_families = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_context_list_families")); - - [Obsolete] - public int ListFamilies(Pango.FontFamily families) { - int n_families; - pango_context_list_families(Handle, families.Handle, out n_families); - return n_families; - } } }