[pango/matthiasc/for-main: 4/5] fonts: Redo the get_face implementation




commit aefc5e509e5865779563c65fc9c9d0ae33b615ab
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Aug 30 23:31:29 2021 -0400

    fonts: Redo the get_face implementation
    
    Now that we have a private class, we can retire
    the misplaced vfunc in the fontmap class.

 pango/fonts.c              | 13 +++++++++++--
 pango/pango-font-private.h |  1 +
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/pango/fonts.c b/pango/fonts.c
index f144097d..d2fd4308 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -1737,6 +1737,14 @@ pango_font_default_has_char (PangoFont *font,
   return result != PANGO_COVERAGE_NONE;
 }
 
+static PangoFontFace *
+pango_font_default_get_face (PangoFont *font)
+{
+  PangoFontMap *map = pango_font_get_font_map (font);
+
+  return PANGO_FONT_MAP_GET_CLASS (map)->get_face (map,font);
+}
+
 static void
 pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
 {
@@ -1751,6 +1759,7 @@ pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
   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;
+  pclass->get_face = pango_font_default_get_face;
 }
 
 static void
@@ -1979,9 +1988,9 @@ pango_font_get_font_map (PangoFont *font)
 PangoFontFace *
 pango_font_get_face (PangoFont *font)
 {
-  PangoFontMap *map = pango_font_get_font_map (font);
+  PangoFontClassPrivate *pclass = PANGO_FONT_GET_CLASS_PRIVATE (font);
 
-  return PANGO_FONT_MAP_GET_CLASS (map)->get_face (map,font);
+  return pclass->get_face (font);
 }
 
 /**
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index 1f31f559..93ce27aa 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -44,6 +44,7 @@ typedef struct {
 
   gboolean         (* has_char) (PangoFont *font,
                                  gunichar   wc);
+  PangoFontFace *  (* get_face) (PangoFont *font);
 } PangoFontClassPrivate;
 
 gboolean pango_font_is_hinted         (PangoFont *font);


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