[pango/simple-fontmap: 11/37] fontset: Add pango_fontset_get_language




commit a5d8fa1159fce338a2d641e5486e54c7944de094
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 | 28 +++++++++++++++++++++++-----
 pango/pango-fontset.h |  2 ++
 3 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/pango/pango-context.c b/pango/pango-context.c
index d5e73cfe..e11f067a 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -581,7 +581,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 fc9e05b8..6267fde1 100644
--- a/pango/pango-fontset.c
+++ b/pango/pango-fontset.c
@@ -58,8 +58,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);
@@ -76,13 +76,31 @@ pango_fontset_get_font (PangoFontset  *fontset,
  * Return value: a `PangoFontMetrics` object
  */
 PangoFontMetrics *
-pango_fontset_get_metrics (PangoFontset  *fontset)
+pango_fontset_get_metrics (PangoFontset *fontset)
 {
   g_return_val_if_fail (PANGO_IS_FONTSET (fontset), NULL);
 
   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`
@@ -113,7 +131,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;
 
@@ -141,7 +159,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 0a222153..e26c19b2 100644
--- a/pango/pango-fontset.h
+++ b/pango/pango-fontset.h
@@ -127,6 +127,8 @@ PANGO_AVAILABLE_IN_1_4
 void                    pango_fontset_foreach           (PangoFontset                   *fontset,
                                                          PangoFontsetForeachFunc         func,
                                                          gpointer                        data);
+PANGO_AVAILABLE_IN_1_52
+PangoLanguage *         pango_fontset_get_language      (PangoFontset                   *fontset);
 
 
 G_END_DECLS


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