From b623f5953691b2a0614e6f1f4def86bdbb9a4113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Aug 2020 11:53:00 +0200 Subject: New upstream version 5.2.0Beta2.1 --- app/wlib/gtklib/font.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'app/wlib/gtklib/font.c') diff --git a/app/wlib/gtklib/font.c b/app/wlib/gtklib/font.c index 68ba87b..e2f741b 100644 --- a/app/wlib/gtklib/font.c +++ b/app/wlib/gtklib/font.c @@ -185,7 +185,8 @@ PangoLayout *wlibFontCreatePangoLayout(GtkWidget *widget, int *width_p, int *height_p, int *ascent_p, - int *descent_p) + int *descent_p, + int *baseline_p) { if (!fontInitted) { fontInit(); @@ -214,14 +215,16 @@ PangoLayout *wlibFontCreatePangoLayout(GtkWidget *widget, FONTSIZE_TO_PANGOSIZE(fs) * PANGO_SCALE); pango_layout_set_font_description(layout, fontDescription); /* get layout measures */ - pango_layout_get_pixel_size(layout, width_p, height_p); + pango_layout_get_size(layout, width_p, height_p); + *width_p = *width_p / PANGO_SCALE; + *height_p = *height_p / PANGO_SCALE; context = gtk_widget_create_pango_context(widget); metrics = pango_context_get_metrics(context, fontDescription, pango_context_get_language(context)); - *ascent_p = PANGO_PIXELS(pango_font_metrics_get_ascent(metrics)); - *descent_p = PANGO_PIXELS(pango_font_metrics_get_descent(metrics)); + *baseline_p = pango_layout_get_baseline(layout) / PANGO_SCALE; + *ascent_p = pango_font_metrics_get_ascent(metrics) / PANGO_SCALE; + *descent_p = pango_font_metrics_get_descent(metrics) / PANGO_SCALE; pango_font_metrics_unref(metrics); - g_object_ref_sink(context); g_object_unref(context); #if WLIB_FONT_DEBUG >= 3 fprintf(stderr, "font layout created:\n"); @@ -347,9 +350,9 @@ wFontSize_t wSelectedFontSize(void) * \return describe the return value */ -void wSetSelectedFontSize(int size) +void wSetSelectedFontSize(wFontSize_t size) { - absoluteFontSize = (wFontSize_t)size; + absoluteFontSize = size; } /** -- cgit v1.2.3