From 566a4c3378f8102795a22b576e0611581d802074 Mon Sep 17 00:00:00 2001 From: zeljko Date: Tue, 22 Sep 2009 15:45:13 +0000 Subject: [PATCH] Qt: bugfix for #14646 - TQtDeviceContext.DrawText() git-svn-id: trunk@21821 - --- lcl/interfaces/qt/qtobjects.pas | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lcl/interfaces/qt/qtobjects.pas b/lcl/interfaces/qt/qtobjects.pas index 195c5c06ec..1c518bbcc5 100644 --- a/lcl/interfaces/qt/qtobjects.pas +++ b/lcl/interfaces/qt/qtobjects.pas @@ -2074,7 +2074,7 @@ end; procedure TQtDeviceContext.drawText(x: Integer; y: Integer; s: PWideString); var ARect: TRect; - FixedY, dy: Integer; + dy: Integer; begin {$ifdef VerboseQt} Write('TQtDeviceContext.drawText TargetX: ', X, ' TargetY: ', Y); @@ -2088,19 +2088,19 @@ begin Rotate(-0.1 * Font.Angle); end; - // what about Font.Metrics.descent and Font.Metrics.leading ? - FixedY := y + Font.Metrics.ascent; - // manual check for clipping if getClipping then begin dy := Font.Metrics.height; ARect := getClipRegion.getBoundingRect; - if (FixedY + dy < ARect.Top) or (FixedY > ARect.Bottom) or + if (y + dy < ARect.Top) or (y > ARect.Bottom) or (x > ARect.Right) then Exit; end; + // what about Font.Metrics.descent and Font.Metrics.leading ? + y := y + Font.Metrics.ascent; + RestoreTextColor; // The ascent is only applied here, because it also needs @@ -2108,13 +2108,14 @@ begin if Font.Angle <> 0 then QPainter_drawText(Widget, 0, Font.Metrics.ascent, s) else - QPainter_drawText(Widget, x, FixedY, s); + QPainter_drawText(Widget, x, y, s); RestorePenColor; // Restore previous angle if Font.Angle <> 0 then begin + y := y - Font.Metrics.ascent; Rotate(0.1 * Font.Angle); Translate(-x, -y); end;