[pango/pango2: 31/61] Drop pango_font_has_char




commit 2a0e38fff2435a862e1d16a69416281049edc658
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 11 14:49:34 2022 -0400

    Drop pango_font_has_char
    
    One can use pango_font_face_has_char instead.

 pango/ellipsize.c            |  4 ++--
 pango/pango-font-private.h   |  2 --
 pango/pango-font.c           | 24 ------------------------
 pango/pango-font.h           |  3 ---
 pango/pango-fontset-cached.c |  3 ++-
 pango/pango-hbfont.c         | 11 -----------
 pango/pango-userfont.c       | 11 -----------
 7 files changed, 4 insertions(+), 54 deletions(-)
---
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index cbd5fdc3d..4269fc17b 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -377,8 +377,8 @@ shape_ellipsis (EllipsizeState *state)
   /* If that fails we use "..." in the first matching font
    */
   if (!item->analysis.font ||
-      !pango_font_has_char (item->analysis.font,
-                            g_utf8_get_char (ellipsis_text)))
+      !pango_font_face_has_char (item->analysis.font->face,
+                                 g_utf8_get_char (ellipsis_text)))
     {
       pango_item_free (item);
 
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index 2423dee7a..e3bb6881c 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -68,8 +68,6 @@ struct _PangoFontClass
   void                   (* get_scale_factors)  (PangoFont      *font,
                                                  double         *x_scale,
                                                  double         *y_scale);
-  gboolean               (* has_char)           (PangoFont      *font,
-                                                 gunichar        wc);
   void                   (* get_matrix)         (PangoFont      *font,
                                                  PangoMatrix    *matrix);
   int                    (* get_absolute_size)  (PangoFont      *font);
diff --git a/pango/pango-font.c b/pango/pango-font.c
index 1ac1e6897..9b9028a2f 100644
--- a/pango/pango-font.c
+++ b/pango/pango-font.c
@@ -66,13 +66,6 @@ pango_font_default_get_scale_factors (PangoFont *font,
   *x_scale = *y_scale = 1.0;
 }
 
-static gboolean
-pango_font_default_has_char (PangoFont *font,
-                             gunichar   wc)
-{
-  return FALSE;
-}
-
 static void
 pango_font_default_get_matrix (PangoFont   *font,
                                PangoMatrix *matrix)
@@ -102,7 +95,6 @@ pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
 
   class->is_hinted = pango_font_default_is_hinted;
   class->get_scale_factors = pango_font_default_get_scale_factors;
-  class->has_char = pango_font_default_has_char;
   class->get_matrix = pango_font_default_get_matrix;
   class->get_absolute_size = pango_font_default_get_absolute_size;
 }
@@ -288,22 +280,6 @@ pango_font_get_hb_font (PangoFont *font)
   return font->hb_font;
 }
 
-/**
- * pango_font_has_char:
- * @font: a `PangoFont`
- * @wc: a Unicode character
- *
- * Returns whether the font provides a glyph for this character.
- *
- * Returns: `TRUE` if @font can render @wc
- */
-gboolean
-pango_font_has_char (PangoFont *font,
-                     gunichar   wc)
-{
-  return PANGO_FONT_GET_CLASS (font)->has_char (font, wc);
-}
-
 /**
  * pango_font_get_features:
  * @font: a `PangoFont`
diff --git a/pango/pango-font.h b/pango/pango-font.h
index f839479cb..7aa1e0e09 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -51,9 +51,6 @@ void                  pango_font_get_glyph_extents (PangoFont        *font,
 PANGO_AVAILABLE_IN_ALL
 PangoFontFace *       pango_font_get_face          (PangoFont        *font);
 
-PANGO_AVAILABLE_IN_ALL
-gboolean              pango_font_has_char          (PangoFont        *font,
-                                                    gunichar          wc);
 PANGO_AVAILABLE_IN_ALL
 void                  pango_font_get_features      (PangoFont        *font,
                                                     hb_feature_t     *features,
diff --git a/pango/pango-fontset-cached.c b/pango/pango-fontset-cached.c
index 06d7a502c..248820277 100644
--- a/pango/pango-fontset-cached.c
+++ b/pango/pango-fontset-cached.c
@@ -24,6 +24,7 @@
 #include <gio/gio.h>
 
 #include "pango-fontset-cached-private.h"
+#include "pango-font-private.h"
 #include "pango-font-face-private.h"
 #include "pango-generic-family-private.h"
 
@@ -79,7 +80,7 @@ pango_fontset_cached_get_font (PangoFontset *fontset,
       if (PANGO_IS_FONT (item))
         {
           PangoFont *font = PANGO_FONT (item);
-          if (pango_font_has_char (font, wc))
+          if (pango_font_face_has_char (font->face, wc))
             {
               retval = g_object_ref (font);
               break;
diff --git a/pango/pango-hbfont.c b/pango/pango-hbfont.c
index 6fad5ddeb..95e482ec1 100644
--- a/pango/pango-hbfont.c
+++ b/pango/pango-hbfont.c
@@ -846,16 +846,6 @@ pango_hb_font_create_hb_font (PangoFont *font)
   return hb_font;
 }
 
-static gboolean
-pango_hb_font_has_char (PangoFont *font,
-                        gunichar   wc)
-{
-  hb_font_t *hb_font = pango_font_get_hb_font (font);
-  hb_codepoint_t glyph;
-
-  return hb_font_get_nominal_glyph (hb_font, wc, &glyph);
-}
-
 static void
 pango_hb_font_get_matrix (PangoFont   *font,
                           PangoMatrix *matrix)
@@ -897,7 +887,6 @@ pango_hb_font_class_init (PangoHbFontClass *class)
   font_class->create_hb_font = pango_hb_font_create_hb_font;
   font_class->get_features = pango_hb_font_get_features;
   font_class->get_matrix = pango_hb_font_get_matrix;
-  font_class->has_char = pango_hb_font_has_char;
 }
 
 /* }}} */
diff --git a/pango/pango-userfont.c b/pango/pango-userfont.c
index 8649d7bd1..bda7ade0d 100644
--- a/pango/pango-userfont.c
+++ b/pango/pango-userfont.c
@@ -327,16 +327,6 @@ pango_user_font_create_hb_font (PangoFont *font)
   return hb_font;
 }
 
-static gboolean
-pango_user_font_has_char (PangoFont *font,
-                          gunichar   wc)
-{
-  hb_font_t *user_font = pango_font_get_hb_font (font);
-  hb_codepoint_t glyph;
-
-  return hb_font_get_nominal_glyph (user_font, wc, &glyph);
-}
-
 static void
 pango_user_font_class_init (PangoUserFontClass *class)
 {
@@ -349,7 +339,6 @@ pango_user_font_class_init (PangoUserFontClass *class)
   font_class->get_glyph_extents = pango_user_font_get_glyph_extents;
   font_class->get_metrics = pango_user_font_get_metrics;
   font_class->create_hb_font = pango_user_font_create_hb_font;
-  font_class->has_char = pango_user_font_has_char;
 }
 
 /* }}} */


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