mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 21:59:07 +02:00
LCL-GTK2: Properly use PANGO_PIXELS macro instead of just integer divide. Issue #39938, patch by Anton Kavalenka.
This commit is contained in:
parent
108196055d
commit
5b2b222aa4
@ -6058,8 +6058,7 @@ begin
|
|||||||
DebugLn(['TGtk2WidgetSet.UpdateDCTextMetric WARNING: no pango metrics']);
|
DebugLn(['TGtk2WidgetSet.UpdateDCTextMetric WARNING: no pango metrics']);
|
||||||
|
|
||||||
TextMetric.tmAveCharWidth := Max(1,
|
TextMetric.tmAveCharWidth := Max(1,
|
||||||
pango_font_metrics_get_approximate_char_width(APangoMetrics)
|
PANGO_PIXELS(pango_font_metrics_get_approximate_char_width(APangoMetrics)));
|
||||||
div PANGO_SCALE);
|
|
||||||
|
|
||||||
TextMetric.tmAscent := PANGO_PIXELS(pango_font_metrics_get_ascent(APangoMetrics));
|
TextMetric.tmAscent := PANGO_PIXELS(pango_font_metrics_get_ascent(APangoMetrics));
|
||||||
TextMetric.tmDescent := PANGO_PIXELS(pango_font_metrics_get_descent(APangoMetrics));
|
TextMetric.tmDescent := PANGO_PIXELS(pango_font_metrics_get_descent(APangoMetrics));
|
||||||
@ -6069,8 +6068,8 @@ begin
|
|||||||
length(PChar(TestString[IsDoubleByteChar])));
|
length(PChar(TestString[IsDoubleByteChar])));
|
||||||
pango_layout_get_extents(UseFont, nil, @aRect);
|
pango_layout_get_extents(UseFont, nil, @aRect);
|
||||||
|
|
||||||
lBearing := PANGO_LBEARING(aRect) div PANGO_SCALE;
|
lBearing :=PANGO_PIXELS(PANGO_LBEARING(aRect));
|
||||||
rBearing := PANGO_RBEARING(aRect) div PANGO_SCALE;
|
rBearing := PANGO_PIXELS(PANGO_RBEARING(aRect));
|
||||||
|
|
||||||
pango_layout_set_text(UseFont, 'M', 1);
|
pango_layout_set_text(UseFont, 'M', 1);
|
||||||
pango_layout_get_pixel_size(UseFont, @aRect.width, @aRect.height);
|
pango_layout_get_pixel_size(UseFont, @aRect.width, @aRect.height);
|
||||||
|
@ -1452,7 +1452,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
aSize := pango_font_description_get_size(PangoDesc);
|
aSize := pango_font_description_get_size(PangoDesc);
|
||||||
if not pango_font_description_get_size_is_absolute(PangoDesc) then
|
if not pango_font_description_get_size_is_absolute(PangoDesc) then
|
||||||
aSize := aSize div PANGO_SCALE;
|
aSize := PANGO_PIXELS(aSize);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -3490,7 +3490,7 @@ var
|
|||||||
|
|
||||||
ALogFontA.lfHeight := pango_font_description_get_size(Font);
|
ALogFontA.lfHeight := pango_font_description_get_size(Font);
|
||||||
if not pango_font_description_get_size_is_absolute(Font) then
|
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
|
// pango does not have underline and strikeout params for font
|
||||||
// ALogFontA.lfUnderline := ;
|
// ALogFontA.lfUnderline := ;
|
||||||
@ -5257,7 +5257,7 @@ begin
|
|||||||
if not pango_font_description_get_size_is_absolute(PangoDesc) then
|
if not pango_font_description_get_size_is_absolute(PangoDesc) then
|
||||||
AFontSize := MulDiv(AFontSize, Screen.PixelsPerInch, 72 * PANGO_SCALE)
|
AFontSize := MulDiv(AFontSize, Screen.PixelsPerInch, 72 * PANGO_SCALE)
|
||||||
else
|
else
|
||||||
AFontSize := AFontSize div PANGO_SCALE;;
|
AFontSize := PANGO_PIXELS(AFontSize);
|
||||||
|
|
||||||
PLogfont(Buf)^.lfHeight := AFontSize;
|
PLogfont(Buf)^.lfHeight := AFontSize;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user