From bde55b119f2068fc027c5ea4cd9e5992024a5e18 Mon Sep 17 00:00:00 2001 From: jesus Date: Sat, 14 Feb 2009 04:55:07 +0000 Subject: [PATCH] LazReport, fix autosize text, issue #13152 git-svn-id: trunk@18680 - --- components/lazreport/source/lr_class.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/lazreport/source/lr_class.pas b/components/lazreport/source/lr_class.pas index 661a172bff..ddda4501b9 100644 --- a/components/lazreport/source/lr_class.pas +++ b/components/lazreport/source/lr_class.pas @@ -2777,6 +2777,7 @@ var CalcRect: TRect; s: String; n: Integer; + DTFlags: Cardinal; begin {$IFDEF DebugLR} DbgOut('TfrMemoView.CalcWidth: text=',dbgstr(aMemo.Text), @@ -2790,13 +2791,18 @@ begin DbgOut(' Canvas.Font.PPI=',dbgs(Canvas.Font.PixelsPerInch), ' Canvas.Font.Size=',dbgs(Canvas.Font.Size)); {$ENDIF} + + DTFlags := DT_CALCRECT; + if Flags and flWordBreak <> 0 then + DTFlags := DT_CALCRECT or DT_WORDBREAK; + s := aMemo.Text; n := Length(s); if n > 2 then if (s[n - 1] = #13) and (s[n] = #10) then SetLength(s, n - 2); SetTextCharacterExtra(Canvas.Handle, Round(CharacterSpacing * ScaleX)); - DrawText(Canvas.Handle, PChar(s), Length(s), CalcRect, DT_CALCRECT); + DrawText(Canvas.Handle, PChar(s), Length(s), CalcRect, DTFlags); Result := CalcRect.Right + Round(2 * FrameWidth) + 2; {$IFDEF DebugLR} DebugLn('RR Width=', dbgs(Result),' Rect=', dbgs(CalcRect));