summaryrefslogtreecommitdiff
path: root/libmetacity/meta-theme.c
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-02-03 22:19:16 +0200
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-02-03 22:19:16 +0200
commit1e87976ef41b277ee7fa39f088df92354d52250b (patch)
tree6afac9f6cab05ce8707078222e998725494abccd /libmetacity/meta-theme.c
parent1ec1849e202687298af71f5f480456585adaac08 (diff)
downloadmetacity-1e87976ef41b277ee7fa39f088df92354d52250b.tar.gz
theme: move meta_pango_font_desc_get_text_height to libmetacity
Diffstat (limited to 'libmetacity/meta-theme.c')
-rw-r--r--libmetacity/meta-theme.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c
index 86818fea..e875ab96 100644
--- a/libmetacity/meta-theme.c
+++ b/libmetacity/meta-theme.c
@@ -406,6 +406,32 @@ meta_style_info_create_font_desc (MetaTheme *theme,
return font_desc;
}
+/**
+ * Returns the height of the letters in a particular font.
+ *
+ * \param font_desc the font
+ * \param context the context of the font
+ * \return the height of the letters
+ */
+gint
+meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
+ PangoContext *context)
+{
+ PangoFontMetrics *metrics;
+ PangoLanguage *lang;
+ int retval;
+
+ lang = pango_context_get_language (context);
+ metrics = pango_context_get_metrics (context, font_desc, lang);
+
+ retval = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
+ pango_font_metrics_get_descent (metrics));
+
+ pango_font_metrics_unref (metrics);
+
+ return retval;
+}
+
gboolean
meta_theme_allows_shade_stick_above_buttons (MetaTheme *theme)
{