[metacity/cowbell] text height code taken from old Metacity
- From: Thomas James Alexander Thurman <tthurman src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [metacity/cowbell] text height code taken from old Metacity
- Date: Mon, 19 Oct 2009 19:11:43 +0000 (UTC)
commit d763fe1ff994cd6068142fc1c2546fee7a5d8fc8
Author: Thomas Thurman <tthurman gnome org>
Date: Mon Oct 19 15:11:28 2009 -0400
text height code taken from old Metacity
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 f9f01e7..0ab7f9a 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]