LCL-GTK2: Properly use PANGO_PIXELS macro instead of just integer divide. Issue #39938, patch by Anton Kavalenka.

This commit is contained in:
Juha 2022-10-03 13:47:08 +03:00
parent 108196055d
commit 5b2b222aa4
2 changed files with 6 additions and 7 deletions

View File

@ -6058,8 +6058,7 @@ begin
DebugLn(['TGtk2WidgetSet.UpdateDCTextMetric WARNING: no pango metrics']);
TextMetric.tmAveCharWidth := Max(1,
pango_font_metrics_get_approximate_char_width(APangoMetrics)
div PANGO_SCALE);
PANGO_PIXELS(pango_font_metrics_get_approximate_char_width(APangoMetrics)));
TextMetric.tmAscent := PANGO_PIXELS(pango_font_metrics_get_ascent(APangoMetrics));
TextMetric.tmDescent := PANGO_PIXELS(pango_font_metrics_get_descent(APangoMetrics));
@ -6069,8 +6068,8 @@ begin
length(PChar(TestString[IsDoubleByteChar])));
pango_layout_get_extents(UseFont, nil, @aRect);
lBearing := PANGO_LBEARING(aRect) div PANGO_SCALE;
rBearing := PANGO_RBEARING(aRect) div PANGO_SCALE;
lBearing :=PANGO_PIXELS(PANGO_LBEARING(aRect));
rBearing := PANGO_PIXELS(PANGO_RBEARING(aRect));
pango_layout_set_text(UseFont, 'M', 1);
pango_layout_get_pixel_size(UseFont, @aRect.width, @aRect.height);

View File

@ -1452,7 +1452,7 @@ begin
begin
aSize := pango_font_description_get_size(PangoDesc);
if not pango_font_description_get_size_is_absolute(PangoDesc) then
aSize := aSize div PANGO_SCALE;
aSize := PANGO_PIXELS(aSize);
end;
end;
end;
@ -3490,7 +3490,7 @@ var
ALogFontA.lfHeight := pango_font_description_get_size(Font);
if not pango_font_description_get_size_is_absolute(Font) then
ALogFontA.lfHeight := ALogFontA.lfHeight div PANGO_SCALE;
ALogFontA.lfHeight := PANGO_PIXELS(ALogFontA.lfHeight);
// pango does not have underline and strikeout params for font
// ALogFontA.lfUnderline := ;
@ -5257,7 +5257,7 @@ begin
if not pango_font_description_get_size_is_absolute(PangoDesc) then
AFontSize := MulDiv(AFontSize, Screen.PixelsPerInch, 72 * PANGO_SCALE)
else
AFontSize := AFontSize div PANGO_SCALE;;
AFontSize := PANGO_PIXELS(AFontSize);
PLogfont(Buf)^.lfHeight := AFontSize;
end;