From c4646eacb5300ea01679b6d7b26a398c8a58c9e0 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 2 Jul 2016 09:20:00 +0000 Subject: [PATCH] tvplanit: A better way to save/restore the font in VpcanvasUtils.DrawRotatedText? git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4892 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/vpcanvasutils.pas | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/tvplanit/source/vpcanvasutils.pas b/components/tvplanit/source/vpcanvasutils.pas index 9bf6147ef..582df70e9 100644 --- a/components/tvplanit/source/vpcanvasutils.pas +++ b/components/tvplanit/source/vpcanvasutils.pas @@ -721,7 +721,7 @@ var OldFont: TFont; RealPoint: TPoint; OldBrushStyle: TBrushStyle; - savedFontHeight: Integer; +// savedFontHeight: Integer; begin if not Assigned(FCanvas) then raise EVpCanvasError.Create(RSNoCanvas); @@ -758,8 +758,10 @@ begin // Create new font to use OldFont := FCanvas.Font; + OldFont := TFont.Create; try - savedFontHeight := FCanvas.Font.Height; + OldFont.Assign(FCanvas.Font); +// savedFontHeight := FCanvas.Font.Height; FCanvas.Font.Handle:= CreateFontIndirect(LF); // Output the text @@ -775,8 +777,9 @@ begin FCanvas.Brush.Style := OldBrushStyle; end; finally - FCanvas.Font := OldFont; - FCanvas.Font.Height := savedFontHeight; + FCanvas.Font.Assign(OldFont); +// FCanvas.Font := OldFont; +// FCanvas.Font.Height := savedFontHeight; end; end;