[pango/pango2: 54/201] Drop PangoFontPrivate




commit 7867d272a72b45c69f55bacc28d4626f90c91392
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 12 14:44:24 2022 -0500

    Drop PangoFontPrivate

 pango/pango-font-private.h |  2 ++
 pango/pango-font.c         | 29 ++++++++---------------------
 2 files changed, 10 insertions(+), 21 deletions(-)
---
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index 79250a03..77bf474d 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -34,6 +34,8 @@ G_BEGIN_DECLS
 struct _PangoFont
 {
   GObject parent_instance;
+
+  hb_font_t *hb_font;
 };
 
 typedef struct _PangoFontClass       PangoFontClass;
diff --git a/pango/pango-font.c b/pango/pango-font.c
index 9154355e..344a91ac 100644
--- a/pango/pango-font.c
+++ b/pango/pango-font.c
@@ -33,24 +33,14 @@
 #include "pango-impl-utils.h"
 
 
-/*
- * PangoFont
- */
-
-typedef struct {
-  hb_font_t *hb_font;
-} PangoFontPrivate;
-
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PangoFont, pango_font, G_TYPE_OBJECT,
-                                  G_ADD_PRIVATE (PangoFont))
+G_DEFINE_ABSTRACT_TYPE (PangoFont, pango_font, G_TYPE_OBJECT)
 
 static void
 pango_font_finalize (GObject *object)
 {
   PangoFont *font = PANGO_FONT (object);
-  PangoFontPrivate *priv = pango_font_get_instance_private (font);
 
-  hb_font_destroy (priv->hb_font);
+  hb_font_destroy (font->hb_font);
 
   G_OBJECT_CLASS (pango_font_parent_class)->finalize (object);
 }
@@ -356,18 +346,15 @@ pango_font_get_face (PangoFont *font)
 hb_font_t *
 pango_font_get_hb_font (PangoFont *font)
 {
-  PangoFontPrivate *priv = pango_font_get_instance_private (font);
-
   g_return_val_if_fail (PANGO_IS_FONT (font), NULL);
 
-  if (priv->hb_font)
-    return priv->hb_font;
-
-  priv->hb_font = PANGO_FONT_GET_CLASS (font)->create_hb_font (font);
-
-  hb_font_make_immutable (priv->hb_font);
+  if (!font->hb_font)
+    {
+      font->hb_font = PANGO_FONT_GET_CLASS (font)->create_hb_font (font);
+      hb_font_make_immutable (font->hb_font);
+    }
 
-  return priv->hb_font;
+  return font->hb_font;
 }
 
 /**


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