mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
gtkfont: use PANGO_PIXELS_CEIL to work out font metrics.
Colin reports that on betas of Ubuntu 20.04, Pango has switched to getting its font metrics from HarfBuzz, and a side effect is apparently that they're being returned in the full precision of PANGO_SCALE fixed point. Previously, Pango appears to have been returning values that were always a whole number of pixels scaled by PANGO_SCALE. Moreover, it looks as if it was rounding the font ascent and descent _up_ to a whole number of pixels, rather than rounding to nearest. But our code rounds to nearest, which means that now the same font gets allocated fewer vertical pixels, which can be enough to cut off some ascenders or descenders. Pango already provides the macro PANGO_PIXELS_CEIL, so it's easy to switch over to using it. This should arrange that any text that fits within the font's stated ascent/descent measurements will also fit in the character cell. (cherry picked from commit f9a46a958157e1d6bd126560623599ed8ee50f32)
This commit is contained in:
parent
b267f35cf7
commit
8896cf55bc
@ -1458,8 +1458,10 @@ static unifont *pangofont_create_internal(GtkWidget *widget,
|
|||||||
pfont->u.vt = &pangofont_vtable;
|
pfont->u.vt = &pangofont_vtable;
|
||||||
pfont->u.width =
|
pfont->u.width =
|
||||||
PANGO_PIXELS(pango_font_metrics_get_approximate_digit_width(metrics));
|
PANGO_PIXELS(pango_font_metrics_get_approximate_digit_width(metrics));
|
||||||
pfont->u.ascent = PANGO_PIXELS(pango_font_metrics_get_ascent(metrics));
|
pfont->u.ascent =
|
||||||
pfont->u.descent = PANGO_PIXELS(pango_font_metrics_get_descent(metrics));
|
PANGO_PIXELS_CEIL(pango_font_metrics_get_ascent(metrics));
|
||||||
|
pfont->u.descent =
|
||||||
|
PANGO_PIXELS_CEIL(pango_font_metrics_get_descent(metrics));
|
||||||
pfont->u.height = pfont->u.ascent + pfont->u.descent;
|
pfont->u.height = pfont->u.ascent + pfont->u.descent;
|
||||||
pfont->u.want_fallback = false;
|
pfont->u.want_fallback = false;
|
||||||
#ifdef DRAW_TEXT_CAIRO
|
#ifdef DRAW_TEXT_CAIRO
|
||||||
|
Loading…
x
Reference in New Issue
Block a user