mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 15:49:27 +02:00
LCL-GTK2: Fix rect calculation and GetTextMetrics. Prevent painting cropped chars 'jy'. Issue #38268, patch from Anton Kavalenka.
git-svn-id: trunk@65056 -
This commit is contained in:
parent
25a1c56fc2
commit
ef7d930ca6
@ -875,7 +875,7 @@ function TGtkDeviceContext.CreateGC: PGdkGC;
|
||||
begin
|
||||
// create GC
|
||||
|
||||
if Drawable <> nil then
|
||||
if (Drawable <> nil) and (Drawable^.parent_instance.ref_count>0) then
|
||||
begin
|
||||
if FWithChildWindows then
|
||||
begin
|
||||
|
@ -5947,8 +5947,9 @@ begin
|
||||
TextMetric.tmAveCharWidth := Max(1,
|
||||
pango_font_metrics_get_approximate_char_width(APangoMetrics)
|
||||
div PANGO_SCALE);
|
||||
TextMetric.tmAscent := pango_font_metrics_get_ascent(APangoMetrics) div PANGO_SCALE;
|
||||
TextMetric.tmDescent := pango_font_metrics_get_descent(APangoMetrics) div PANGO_SCALE;
|
||||
|
||||
TextMetric.tmAscent := PANGO_PIXELS(pango_font_metrics_get_ascent(APangoMetrics));
|
||||
TextMetric.tmDescent := PANGO_PIXELS(pango_font_metrics_get_descent(APangoMetrics));
|
||||
TextMetric.tmHeight := TextMetric.tmAscent+TextMetric.tmDescent;
|
||||
|
||||
pango_layout_set_text(UseFont, PChar(TestString[IsDoubleByteChar]),
|
||||
|
@ -2483,6 +2483,7 @@ var
|
||||
else
|
||||
begin
|
||||
theRect.Right := theRect.Left + Min(MaxWidth, AP.cX);
|
||||
theRect.Bottom := theRect.Top + AP.cY;
|
||||
if (Flags and DT_VCENTER) > 0 then
|
||||
begin
|
||||
OffsetRect(theRect, 0, ((Rect.Bottom - Rect.Top) - (theRect.Bottom - theRect.Top)) div 2);
|
||||
@ -2492,6 +2493,7 @@ var
|
||||
begin
|
||||
OffsetRect(theRect, 0, (Rect.Bottom - Rect.Top) - (theRect.Bottom - theRect.Top));
|
||||
end;
|
||||
|
||||
end;
|
||||
end
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user