[pango/matthiasc/for-main: 2/2] Cosmetics




commit 3f492004d1e0845fbcc16abf0f54c1c2d089c262
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 24 16:58:15 2021 -0700

    Cosmetics
    
    Add default implementations for is_monospace and is_variable.

 pango/fonts.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/pango/fonts.c b/pango/fonts.c
index d2fd4308..63325c22 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -2329,9 +2329,23 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PangoFontFamily, pango_font_family, G_TYPE_OBJ
 static PangoFontFace *pango_font_family_real_get_face (PangoFontFamily *family,
                                                        const char      *name);
 
+static gboolean
+pango_font_family_default_is_monospace (PangoFontFamily *family)
+{
+  return FALSE;
+}
+
+static gboolean
+pango_font_family_default_is_variable (PangoFontFamily *family)
+{
+  return FALSE;
+}
+
 static void
 pango_font_family_class_init (PangoFontFamilyClass *class G_GNUC_UNUSED)
 {
+  class->is_monospace = pango_font_family_default_is_monospace;
+  class->is_variable = pango_font_family_default_is_variable;
   class->get_face = pango_font_family_real_get_face;
 }
 
@@ -2469,10 +2483,7 @@ pango_font_family_is_monospace (PangoFontFamily  *family)
 {
   g_return_val_if_fail (PANGO_IS_FONT_FAMILY (family), FALSE);
 
-  if (PANGO_FONT_FAMILY_GET_CLASS (family)->is_monospace)
-    return PANGO_FONT_FAMILY_GET_CLASS (family)->is_monospace (family);
-  else
-    return FALSE;
+  return PANGO_FONT_FAMILY_GET_CLASS (family)->is_monospace (family);
 }
 
 /**
@@ -2491,10 +2502,7 @@ pango_font_family_is_variable (PangoFontFamily  *family)
 {
   g_return_val_if_fail (PANGO_IS_FONT_FAMILY (family), FALSE);
 
-  if (PANGO_FONT_FAMILY_GET_CLASS (family)->is_variable)
-    return PANGO_FONT_FAMILY_GET_CLASS (family)->is_variable (family);
-  else
-    return FALSE;
+  return PANGO_FONT_FAMILY_GET_CLASS (family)->is_variable (family);
 }
 
 /*


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