[pango/font-features-getter: 1/3] Add an api to get features of a font



commit 9ca6fde86a534854b088f09effe02589fdb9a64b
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jul 9 23:08:37 2019 -0400

    Add an api to get features of a font

 docs/pango-sections.txt    |  1 +
 pango/fonts.c              | 24 ++++++++++++++++++++++++
 pango/pango-font-private.h |  6 +++++-
 pango/pango-font.h         |  6 ++++++
 4 files changed, 36 insertions(+), 1 deletion(-)
---
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 0fc648af..9b077f56 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -236,6 +236,7 @@ pango_font_covers
 pango_font_get_glyph_extents
 pango_font_get_metrics
 pango_font_get_font_map
+pango_font_get_features
 <SUBSECTION>
 PangoFontFamily
 PANGO_TYPE_FONT_FAMILY
diff --git a/pango/fonts.c b/pango/fonts.c
index 2dd39f2e..081596df 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -2327,3 +2327,27 @@ pango_font_covers (PangoFont *font,
   pango_coverage_unref (coverage);
   return result != PANGO_COVERAGE_NONE;
 }
+
+/**
+ * pango_font_get_features:
+ * @font: a #PangoFont
+ * @features: (out caller-allocates) (array length=len): Array to features in
+ * @len: the length of @features
+ * @num_features: (inout): the number of used items in @features
+ *
+ * Obtain the OpenType features for this font.
+ *
+ * These are the features used by default for this font,
+ * unless overridden.
+ *
+ * Since: 1.44
+ */
+void
+pango_font_get_features (PangoFont    *font,
+                         hb_feature_t *features,
+                         guint         len,
+                         guint        *num_features)
+{
+  if (PANGO_FONT_GET_CLASS (font)->get_features)
+    PANGO_FONT_GET_CLASS (font)->get_features (font, features, len, num_features);
+}
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index 5d7bb4de..be399d7d 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -175,11 +175,15 @@ struct _PangoFontClass
                                               PangoLanguage  *language);
   PangoFontMap *        (*get_font_map)       (PangoFont      *font);
   PangoFontDescription *(*describe_absolute)  (PangoFont      *font);
+  void                  (*get_features)       (PangoFont      *font,
+                                               hb_feature_t   *features,
+                                               guint           len,
+                                               guint          *num_features);
+
   /*< private >*/
 
   /* Padding for future expansion */
   void (*_pango_reserved1) (void);
-  void (*_pango_reserved2) (void);
 };
 
 /* used for very rare and miserable situtations that we cannot even
diff --git a/pango/pango-font.h b/pango/pango-font.h
index 84d4e122..e053875b 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -487,6 +487,12 @@ PangoFontMap         *pango_font_get_font_map      (PangoFont        *font);
 PANGO_AVAILABLE_IN_1_44
 gboolean              pango_font_covers            (PangoFont        *font,
                                                     gunichar          unichar);
+PANGO_AVAILABLE_IN_1_44
+void                  pango_font_get_features      (PangoFont        *font,
+                                                    hb_feature_t     *features,
+                                                    guint             len,
+                                                    guint            *num_features);
+
 
 /**
  * PANGO_GLYPH_EMPTY:


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