[pango/pango2: 65/178] Drop pango_font_get_font_map




commit 81ce1aff9fc0d6a131f29ebeb3832328ce6560e7
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 11 11:31:14 2022 -0400

    Drop pango_font_get_font_map

 pango/pango-font-private.h |  1 -
 pango/pango-font.c         | 31 -------------------------------
 pango/pango-font.h         |  2 --
 pango/pango-hbfont.c       | 14 ++++----------
 pango/pango-userfont.c     |  9 ---------
 pango/pangocairo-font.c    |  8 +++++++-
 6 files changed, 11 insertions(+), 54 deletions(-)
---
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index 93c33577e..82389f0ea 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -51,7 +51,6 @@ struct _PangoFontClass
                                                 PangoRectangle *logical_rect);
   PangoFontMetrics *     (* get_metrics)        (PangoFont      *font,
                                                 PangoLanguage  *language);
-  PangoFontMap *         (* get_font_map)       (PangoFont      *font);
   PangoFontDescription * (* describe_absolute)  (PangoFont      *font);
   void                   (* get_features)       (PangoFont      *font,
                                                  hb_feature_t   *features,
diff --git a/pango/pango-font.c b/pango/pango-font.c
index 9e2e17ad4..698763ca3 100644
--- a/pango/pango-font.c
+++ b/pango/pango-font.c
@@ -259,37 +259,6 @@ pango_font_get_metrics (PangoFont     *font,
   return PANGO_FONT_GET_CLASS (font)->get_metrics (font, language);
 }
 
-/**
- * pango_font_get_font_map:
- * @font: (nullable): a `PangoFont`
- *
- * Gets the font map for which the font was created.
- *
- * Note that the font maintains a *weak* reference to
- * the font map, so if all references to font map are
- * dropped, the font map will be finalized even if there
- * are fonts created with the font map that are still alive.
- * In that case this function will return %NULL.
- *
- * It is the responsibility of the user to ensure that the
- * font map is kept alive. In most uses this is not an issue
- * as a `PangoContext` holds a reference to the font map.
- *
- * Return value: (transfer none) (nullable): the `PangoFontMap`
- *   for the font
- */
-PangoFontMap *
-pango_font_get_font_map (PangoFont *font)
-{
-  if (G_UNLIKELY (!font))
-    return NULL;
-
-  if (PANGO_FONT_GET_CLASS (font)->get_font_map)
-    return PANGO_FONT_GET_CLASS (font)->get_font_map (font);
-  else
-    return NULL;
-}
-
 /**
  * pango_font_get_face:
  * @font: a `PangoFont`
diff --git a/pango/pango-font.h b/pango/pango-font.h
index 8de3126d0..ed344dcc8 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -47,8 +47,6 @@ void                  pango_font_get_glyph_extents (PangoFont        *font,
                                                     PangoGlyph        glyph,
                                                     PangoRectangle   *ink_rect,
                                                     PangoRectangle   *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-PangoFontMap         *pango_font_get_font_map      (PangoFont        *font);
 
 PANGO_AVAILABLE_IN_ALL
 PangoFontFace *       pango_font_get_face          (PangoFont        *font);
diff --git a/pango/pango-hbfont.c b/pango/pango-hbfont.c
index bc51c03d5..b88fc849b 100644
--- a/pango/pango-hbfont.c
+++ b/pango/pango-hbfont.c
@@ -107,14 +107,6 @@ get_max_char_size (PangoFont  *font,
     *height = h;
 }
 
-static PangoFontMap *
-pango_hb_font_get_font_map (PangoFont *font)
-{
-  PangoHbFont *self = PANGO_HB_FONT (font);
-
-  return self->face->family->map;
-}
-
 static PangoVariant
 pango_variant_from_features (hb_feature_t *features,
                              unsigned int  n_features)
@@ -354,7 +346,10 @@ create_hex_box_info (PangoHbFont *self)
   PangoContext *context;
   PangoFontMap *map;
 
-  map = pango_hb_font_get_font_map (PANGO_FONT (self));
+  if (!self->face->family)
+    return NULL;
+
+  map = self->face->family->map;
 
   if (!map)
     return NULL;
@@ -917,7 +912,6 @@ pango_hb_font_class_init (PangoHbFontClass *class)
   font_class->describe_absolute = pango_hb_font_describe_absolute;
   font_class->get_glyph_extents = pango_hb_font_get_glyph_extents;
   font_class->get_metrics = pango_hb_font_get_metrics;
-  font_class->get_font_map = pango_hb_font_get_font_map;
   font_class->create_hb_font = pango_hb_font_create_hb_font;
   font_class->get_features = pango_hb_font_get_features;
   font_class->has_char = pango_hb_font_has_char;
diff --git a/pango/pango-userfont.c b/pango/pango-userfont.c
index ed7671e52..cc1ea4d17 100644
--- a/pango/pango-userfont.c
+++ b/pango/pango-userfont.c
@@ -241,14 +241,6 @@ pango_user_font_get_metrics (PangoFont     *font,
   return metrics;
 }
 
-static PangoFontMap *
-pango_user_font_get_font_map (PangoFont *font)
-{
-  PangoUserFont *self = PANGO_USER_FONT (font);
-
-  return self->face->family->map;
-}
-
 static hb_bool_t
 nominal_glyph_func (hb_font_t *font, void *font_data,
                     hb_codepoint_t unicode,
@@ -382,7 +374,6 @@ pango_user_font_class_init (PangoUserFontClass *class)
   font_class->describe_absolute = pango_user_font_describe_absolute;
   font_class->get_glyph_extents = pango_user_font_get_glyph_extents;
   font_class->get_metrics = pango_user_font_get_metrics;
-  font_class->get_font_map = pango_user_font_get_font_map;
   font_class->create_hb_font = pango_user_font_create_hb_font;
   font_class->has_char = pango_user_font_has_char;
   font_class->get_face = pango_user_font_get_face;
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 865dfe22f..996ae39c3 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -405,11 +405,17 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
 
   /* create mini_font description */
   {
+    PangoFontFace *face;
+    PangoFontFamily *family;
     PangoFontMap *fontmap;
     PangoContext *context;
 
     /* XXX this is racy.  need a ref'ing getter... */
-    fontmap = pango_font_get_font_map (cf_priv->cfont);
+    face = pango_font_get_face (cf_priv->cfont);
+    family = pango_font_face_get_family (face);
+    if (!family)
+      return NULL;
+    fontmap = pango_font_family_get_font_map (family);
     if (!fontmap)
       return NULL;
     fontmap = g_object_ref (fontmap);


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