diff options
author | Thomas Thurman <tthurman@gnome.org> | 2009-10-19 15:11:28 -0400 |
---|---|---|
committer | Thomas Thurman <tthurman@gnome.org> | 2009-10-19 15:11:28 -0400 |
commit | d763fe1ff994cd6068142fc1c2546fee7a5d8fc8 (patch) | |
tree | 63af549ba5211d6d27e095af1d055a1de756617b | |
parent | c15151f73193dddb8887f406cced061e9e2f18b5 (diff) | |
download | metacity-d763fe1ff994cd6068142fc1c2546fee7a5d8fc8.tar.gz |
text height code taken from old Metacity
-rw-r--r-- | src/ui/theme.c | 23 |
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 |