diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 21:26:53 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 21:26:53 +0200 |
commit | df247efec654e512242e4f4f1b0212034f9e01fe (patch) | |
tree | 25c02e16957f3aa613af30c140fd8e8a3d52fda6 /app/wlib/gtklib/font.c | |
parent | d0b6a8a4ec298024f14f704f9e40a6f9d324ccf3 (diff) | |
parent | a5ade52caa489cf0a713e0f02b764000d203140e (diff) |
Merge branch 'release/debian/1%5.2.0Beta2.1-1' into masterdebian/1%5.2.0Beta2.1-1
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; } /** |