[pango/variable-face: 26/29] Add a variable family API



commit 68050fbf5caea4b58b1cba14615a01f646ff8114
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 15 16:00:45 2018 -0400

    Add a variable family API
    
    pango_font_family_is_variable() return whether a font
    family supports font variations.

 pango/fonts.c      | 22 ++++++++++++++++++++++
 pango/pango-font.h |  4 +++-
 2 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/pango/fonts.c b/pango/fonts.c
index d9a07c0b..63e7c7b9 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -2147,6 +2147,28 @@ pango_font_family_is_monospace (PangoFontFamily  *family)
     return FALSE;
 }
 
+/**
+ * pango_font_family_is_variable:
+ * @family: a #PangoFontFamily
+ *
+ * A variable font is a font which has axes that can be modified to
+ * produce different faces.
+ *
+ * Return value: %TRUE if the family is variable
+ *
+ * Since: 1.44
+ **/
+gboolean
+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;
+}
+
 /*
  * PangoFontFace
  */
diff --git a/pango/pango-font.h b/pango/pango-font.h
index 4af31a95..1b85c386 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -409,6 +409,8 @@ PANGO_AVAILABLE_IN_ALL
 const char *pango_font_family_get_name   (PangoFontFamily  *family) G_GNUC_PURE;
 PANGO_AVAILABLE_IN_1_4
 gboolean   pango_font_family_is_monospace         (PangoFontFamily  *family) G_GNUC_PURE;
+PANGO_AVAILABLE_IN_1_44
+gboolean   pango_font_family_is_variable          (PangoFontFamily  *family) G_GNUC_PURE;
 
 #ifdef PANGO_ENABLE_BACKEND
 
@@ -442,13 +444,13 @@ struct _PangoFontFamilyClass
                            int              *n_faces);
   const char * (*get_name) (PangoFontFamily  *family);
   gboolean (*is_monospace) (PangoFontFamily *family);
+  gboolean (*is_variable)  (PangoFontFamily *family);
 
   /*< private >*/
 
   /* Padding for future expansion */
   void (*_pango_reserved2) (void);
   void (*_pango_reserved3) (void);
-  void (*_pango_reserved4) (void);
 };
 
 #endif /* PANGO_ENABLE_BACKEND */


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