summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Thurman <tthurman@gnome.org>2009-10-19 15:11:28 -0400
committerThomas Thurman <tthurman@gnome.org>2009-10-19 15:11:28 -0400
commitd763fe1ff994cd6068142fc1c2546fee7a5d8fc8 (patch)
tree63af549ba5211d6d27e095af1d055a1de756617b
parentc15151f73193dddb8887f406cced061e9e2f18b5 (diff)
downloadmetacity-d763fe1ff994cd6068142fc1c2546fee7a5d8fc8.tar.gz
text height code taken from old Metacity
-rw-r--r--src/ui/theme.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/ui/theme.c b/src/ui/theme.c
index f9f01e75..0ab7f9ab 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -809,12 +809,31 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget,
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
+ */
int
meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
PangoContext *context)
{
- /* stub */
- return 0;
+ 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;
}
#if 0