Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2019-11

gtk2 font sizes

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

C Western

I have just upgraded to Fedora 31, and noticed some odd effects with font sizes. With some investigation the cause seems to be that the underlying font sizes can be a non-integer number of pixels; with a 'MonoSpace' example :5919:

TextMetric.tmAscent := pango_font_metrics_get_ascent(APangoMetrics) div
PANGO_SCALE;

evaluates as 11406/1024 = 11.129 which is truncated to 11

TextMetric.tmDescent := pango_font_metrics_get_descent(APangoMetrics)
div PANGO_SCALE;

evaluates as  2898/1024 = 2.83 which is truncated to 2.

The effective font height seems to be 2 pixels larger in this case, ot at least that is what is required to fix previously working code. I wonder if these calculations should be rounded up rather than down?

Colin

Reply by email