[pango/pango2: 135/195] fontset: Add pango_fontset_get_language




commit 870f20235c0569f4173041b84bd4ab37c0e5d247
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 1 01:08:50 2022 -0500

    fontset: Add pango_fontset_get_language
    
    This was a missing wrapper for an existing vfunc.

 pango/pango-context.c |  2 +-
 pango/pango-fontset.c | 26 ++++++++++++++++++++++----
 pango/pango-fontset.h |  2 ++
 3 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/pango/pango-context.c b/pango/pango-context.c
index aae16d88..a27fcf1f 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -549,7 +549,7 @@ get_first_metrics_foreach (PangoFontset  *fontset,
                            gpointer       data)
 {
   PangoFontMetrics *fontset_metrics = data;
-  PangoLanguage *language = PANGO_FONTSET_GET_CLASS (fontset)->get_language (fontset);
+  PangoLanguage *language = pango_fontset_get_language (fontset);
   PangoFontMetrics *font_metrics = pango_font_get_metrics (font, language);
   guint save_ref_count;
 
diff --git a/pango/pango-fontset.c b/pango/pango-fontset.c
index e531692c..1617cef0 100644
--- a/pango/pango-fontset.c
+++ b/pango/pango-fontset.c
@@ -57,8 +57,8 @@ pango_fontset_class_init (PangoFontsetClass *class)
  * Return value: (transfer full): a `PangoFont`
  */
 PangoFont *
-pango_fontset_get_font (PangoFontset  *fontset,
-                        guint          wc)
+pango_fontset_get_font (PangoFontset *fontset,
+                        guint         wc)
 {
 
   g_return_val_if_fail (PANGO_IS_FONTSET (fontset), NULL);
@@ -82,6 +82,24 @@ pango_fontset_get_metrics (PangoFontset *fontset)
   return PANGO_FONTSET_GET_CLASS (fontset)->get_metrics (fontset);
 }
 
+/**
+ * pango_fontset_get_language:
+ * @fontset: a `PangoFontset`
+ *
+ * Gets the language that the fontset was created for.
+ *
+ * Returns: the language that @fontset was created for
+ *
+ * Since: 1.52
+ */
+PangoLanguage *
+pango_fontset_get_language (PangoFontset *fontset)
+{
+  g_return_val_if_fail (PANGO_IS_FONTSET (fontset), NULL);
+
+  return PANGO_FONTSET_GET_CLASS (fontset)->get_language (fontset);
+}
+
 /**
  * pango_fontset_foreach:
  * @fontset: a `PangoFontset`
@@ -112,7 +130,7 @@ get_first_metrics_foreach (PangoFontset  *fontset,
                            gpointer       data)
 {
   PangoFontMetrics *fontset_metrics = data;
-  PangoLanguage *language = PANGO_FONTSET_GET_CLASS (fontset)->get_language (fontset);
+  PangoLanguage *language = pango_fontset_get_language (fontset);
   PangoFontMetrics *font_metrics = pango_font_get_metrics (font, language);
   guint save_ref_count;
 
@@ -140,7 +158,7 @@ pango_fontset_real_get_metrics (PangoFontset  *fontset)
   PangoFont *font;
   PangoLanguage *language;
 
-  language = PANGO_FONTSET_GET_CLASS (fontset)->get_language (fontset);
+  language = pango_fontset_get_language (fontset);
   sample_str = pango_language_get_sample_string (language);
 
   count = 0;
diff --git a/pango/pango-fontset.h b/pango/pango-fontset.h
index 477fc41d..9c2409c1 100644
--- a/pango/pango-fontset.h
+++ b/pango/pango-fontset.h
@@ -82,6 +82,8 @@ PANGO_AVAILABLE_IN_1_4
 void                    pango_fontset_foreach           (PangoFontset                   *fontset,
                                                          PangoFontsetForeachFunc         func,
                                                          gpointer                        data);
+PANGO_AVAILABLE_IN_ALL
+PangoLanguage *         pango_fontset_get_language      (PangoFontset                   *fontset);
 
 
 G_END_DECLS


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