summaryrefslogtreecommitdiff
path: root/pango/pangofc-font.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-09-08 14:25:42 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-09-18 14:54:11 -0400
commit87b99bbbbaed141e05268f87eb2928eee780c3d7 (patch)
tree1797062567908a85ed035afda69481cbb787142d /pango/pangofc-font.c
parent937af77bcf7d689a85d549c573edd2de7bafbe5b (diff)
downloadpango-87b99bbbbaed141e05268f87eb2928eee780c3d7.tar.gz
pangofc: Add pango_fc_font_get_languagespreferred-languages
This really belongs into PangoFont, but we're out of room in the PangoFontClass struct for vfuncs, so this will have to remain backend-specific functionality for now.
Diffstat (limited to 'pango/pangofc-font.c')
-rw-r--r--pango/pangofc-font.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 7456cd9e..6c5492ad 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -1035,3 +1035,35 @@ pango_fc_font_create_hb_font (PangoFont *font)
done:
return hb_font;
}
+
+/**
+ * pango_fc_font_get_languages:
+ * @font: a #PangoFcFont
+ *
+ * Returns the languages that are supported by @font.
+ *
+ * This corresponds to the FC_LANG member of the FcPattern.
+ *
+ * The returned array is only valid as long as the font
+ * and its fontmap are valid.
+ *
+ * Returns: (transfer none) (nullable): a %NULL-terminated
+ * array of PangoLanguage*
+ *
+ * Since: 1.48
+ */
+PangoLanguage **
+pango_fc_font_get_languages (PangoFcFont *font)
+{
+ PangoFcFontMap *fontmap;
+ PangoLanguage **languages;
+
+ fontmap = g_weak_ref_get ((GWeakRef *) &font->fontmap);
+ if (!fontmap)
+ return NULL;
+
+ languages = _pango_fc_font_map_get_languages (fontmap, font);
+ g_object_unref (fontmap);
+
+ return languages;
+}