summaryrefslogtreecommitdiff
path: root/pango/fonts.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-07-04 22:06:06 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-07-05 15:47:23 -0400
commitd75d9598e8b0a704c7bbfbbc61877386b6a86327 (patch)
tree42a727cd32702883f4f7f06288e069fad518619b /pango/fonts.c
parent05750deb6fbab92a1635b00085f819c96eafb38f (diff)
downloadpango-d75d9598e8b0a704c7bbfbbc61877386b6a86327.tar.gz
Add line height to font metrics
Add a getter for the line height of a font.
Diffstat (limited to 'pango/fonts.c')
-rw-r--r--pango/fonts.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/pango/fonts.c b/pango/fonts.c
index 6a7778d3..f273cd26 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -1793,6 +1793,7 @@ pango_font_get_metrics (PangoFont *font,
metrics->ascent = PANGO_SCALE * PANGO_UNKNOWN_GLYPH_HEIGHT;
metrics->descent = 0;
+ metrics->height = 0;
metrics->approximate_char_width = PANGO_SCALE * PANGO_UNKNOWN_GLYPH_WIDTH;
metrics->approximate_digit_width = PANGO_SCALE * PANGO_UNKNOWN_GLYPH_WIDTH;
metrics->underline_position = -PANGO_SCALE;
@@ -1940,6 +1941,28 @@ pango_font_metrics_get_descent (PangoFontMetrics *metrics)
}
/**
+ * pango_font_metrics_get_height:
+ * @metrics: a #PangoFontMetrics structure
+ *
+ * Gets the line height from a font metrics structure. The
+ * line height is the distance between successive baselines
+ * in wrapped text.
+ *
+ * If the line height is not available, 0 is returned.
+ *
+ * Return value: the height, in Pango units
+ *
+ * Since: 1.44
+ */
+int
+pango_font_metrics_get_height (PangoFontMetrics *metrics)
+{
+ g_return_val_if_fail (metrics != NULL, 0);
+
+ return metrics->height;
+}
+
+/**
* pango_font_metrics_get_approximate_char_width:
* @metrics: a #PangoFontMetrics structure
*