[pango/matthiasc/for-main: 3/4] font: Add a vfunc for pango_font_has_char




commit 6924489203c20e5462ed19ee714c53b02393f1b0
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 27 22:02:14 2021 -0400

    font: Add a vfunc for pango_font_has_char

 pango/fonts.c              | 18 ++++++++++++++----
 pango/pango-font-private.h |  2 ++
 2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/pango/fonts.c b/pango/fonts.c
index 45d05b38..f144097d 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -1727,6 +1727,16 @@ 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)
+{
+  PangoCoverage *coverage = pango_font_get_coverage (font, pango_language_get_default ());
+  PangoCoverageLevel result = pango_coverage_get (coverage, wc);
+  pango_coverage_unref (coverage);
+  return result != PANGO_COVERAGE_NONE;
+}
+
 static void
 pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
 {
@@ -1740,6 +1750,7 @@ pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
   pclass->get_languages = pango_font_default_get_languages;
   pclass->is_hinted = pango_font_default_is_hinted;
   pclass->get_scale_factors = pango_font_default_get_scale_factors;
+  pclass->has_char = pango_font_default_has_char;
 }
 
 static void
@@ -2626,10 +2637,9 @@ gboolean
 pango_font_has_char (PangoFont *font,
                      gunichar   wc)
 {
-  PangoCoverage *coverage = pango_font_get_coverage (font, pango_language_get_default ());
-  PangoCoverageLevel result = pango_coverage_get (coverage, wc);
-  pango_coverage_unref (coverage);
-  return result != PANGO_COVERAGE_NONE;
+  PangoFontClassPrivate *pclass = PANGO_FONT_GET_CLASS_PRIVATE (font);
+
+  return pclass->has_char (font, wc);
 }
 
 /**
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index d9845fab..1f31f559 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -42,6 +42,8 @@ typedef struct {
                                           double    *x_scale,
                                           double    *y_scale);
 
+  gboolean         (* has_char) (PangoFont *font,
+                                 gunichar   wc);
 } PangoFontClassPrivate;
 
 gboolean pango_font_is_hinted         (PangoFont *font);


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