[Lazarus] gtk2 font sizes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] gtk2 font sizes

Free Pascal - Lazarus mailing list
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 looking at gtk2widgetset.inc: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



--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus