summaryrefslogtreecommitdiff
path: root/app/wlib/gtklib/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/wlib/gtklib/font.c')
-rw-r--r--app/wlib/gtklib/font.c17
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;
}
/**