Re: PangoLayoutLine and language bindings



A Qui, 2003-05-15 às 18:17, Gustavo J. A. M. Carneiro escreveu:
>   I was thinking I will need to access individual PangoLayoutLine's
> inside a PangoLayout from pygtk.  However, this is not implemented in
> pygtk.  Since PangoLayoutLine is not GType-registered, I can understand
> why.
> 
>   So, I propose:
> 	1. Add reference counting to PangoLayoutLine;  However, as I was
> writing this, I realized this is already implemented :-)
> 	2. Register it as boxed type, G_TYPE_PANGO_LAYOUT_LINE, with the copy
> function being pango_layout_line_ref() and the free function being
> pango_layout_line_unref().
> 
>   So, can I send a gtk+ patch for this?

  Any problem committing this patch, then?

-- 
Gustavo João Alves Marques Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/pango/ChangeLog,v
retrieving revision 1.658.2.43
diff -u -p -u -p -r1.658.2.43 ChangeLog
--- ChangeLog	2 May 2003 21:46:08 -0000	1.658.2.43
+++ ChangeLog	16 May 2003 13:32:21 -0000
@@ -1,3 +1,9 @@
+2003-05-16  Gustavo J. A. M. Carneiro  <gustavo users sourceforge net>
+
+	* pango/pango-layout.h, pango/pango-layout.c
+	(pango_layout_line_get_type): Register PangoLayoutLine as boxed
+	type, useful for language bindings.
+
 Fri May  2 17:20:23 2003  Owen Taylor  <otaylor redhat com>
 
 	* pango/mapping.c (pango_glyph_string_x_to_index): 
Index: pango/pango-layout.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-layout.c,v
retrieving revision 1.97.2.3
diff -u -p -u -p -r1.97.2.3 pango-layout.c
--- pango/pango-layout.c	2 May 2003 18:23:39 -0000	1.97.2.3
+++ pango/pango-layout.c	16 May 2003 13:32:22 -0000
@@ -4696,3 +4696,31 @@ pango_layout_iter_get_layout_extents  (P
   if (logical_rect)
     *logical_rect = iter->logical_rect;
 }
+
+
+static gpointer
+_pango_layout_line_boxed_copy (gpointer boxed)
+{
+  pango_layout_line_ref ((PangoLayoutLine *) boxed);
+  return boxed;
+}
+
+static void
+_pango_layout_line_boxed_free (gpointer boxed)
+{
+  pango_layout_line_unref ((PangoLayoutLine *) boxed);
+}
+
+GType
+pango_layout_line_get_type (void)
+{
+  static GType gtype = 0;
+  
+  if (!gtype) {
+    gtype = g_boxed_type_register_static ("PangoLayoutLine",
+					  _pango_layout_line_boxed_copy,
+					  _pango_layout_line_boxed_free);
+  }
+  return gtype;
+}
+
Index: pango/pango-layout.h
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-layout.h,v
retrieving revision 1.30
diff -u -p -u -p -r1.30 pango-layout.h
--- pango/pango-layout.h	3 Dec 2002 06:21:49 -0000	1.30
+++ pango/pango-layout.h	16 May 2003 13:32:22 -0000
@@ -64,11 +64,14 @@ struct _PangoLayoutLine
 #define PANGO_LAYOUT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_LAYOUT, PangoLayoutClass))
 
 
+#define PANGO_TYPE_LAYOUT_LINE         (pango_layout_line_get_type ())
+
 /* The PangoLayout and PangoLayoutClass structs are private; if you
  * need to create a subclass of these, mail otaylor redhat com
  */
 
 GType        pango_layout_get_type       (void) G_GNUC_CONST;
+GType        pango_layout_line_get_type  (void) G_GNUC_CONST;
 PangoLayout *pango_layout_new            (PangoContext   *context);
 PangoLayout *pango_layout_copy           (PangoLayout    *src);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]