diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-22 14:05:41 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-22 14:05:41 +0200 |
commit | b55285a77da0e0b829e4ce8d7e09debaabc68e15 (patch) | |
tree | f622559ef65bbdd3e1c5bdb06098a8f89eec0563 /app/wlib/gtklib/font.c | |
parent | d3897ce090dbeb220ed2c782f095597e417cf3cc (diff) | |
parent | d1ae75703e1ed81d65ea16946dcdb77e7a13adc9 (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'app/wlib/gtklib/font.c')
-rw-r--r-- | app/wlib/gtklib/font.c | 17 |
1 files changed, 10 insertions, 7 deletions
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; } /** |