[pango/kill-ft-face: 20/33] Add an api to get features of a font



commit 3a3196b6dc5a857942f153f5ae6658037ab734f8
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 |  8 ++++----
 pango/pango-font.h         |  5 +++++
 4 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 4de8945e..629356ac 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -237,6 +237,7 @@ pango_font_get_glyph_extents
 pango_font_get_metrics
 pango_font_get_font_map
 pango_font_get_hb_font
+pango_font_get_features
 <SUBSECTION>
 PangoFontFamily
 PANGO_TYPE_FONT_FAMILY
diff --git a/pango/fonts.c b/pango/fonts.c
index 7199277e..f3fd9dea 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -2375,3 +2375,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 0922df9c..ae2b2ce4 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -176,11 +176,11 @@ struct _PangoFontClass
   PangoFontMap *        (*get_font_map)       (PangoFont      *font);
   PangoFontDescription *(*describe_absolute)  (PangoFont      *font);
   hb_font_t *           (*create_hb_font)     (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);
 };
 
 /* used for very rare and miserable situtations that we cannot even
diff --git a/pango/pango-font.h b/pango/pango-font.h
index 50287b99..085bbb20 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -490,6 +490,11 @@ gboolean              pango_font_covers            (PangoFont        *font,
                                                     gunichar          unichar);
 PANGO_AVAILABLE_IN_1_44
 hb_font_t *           pango_font_get_hb_font       (PangoFont        *font);
+PANGO_AVAILABLE_IN_1_44
+void                  pango_font_get_features      (PangoFont        *font,
+                                                    hb_feature_t     *features,
+                                                    guint             len,
+                                                    guint            *num_features);
 
 
 /**


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