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
This commit is contained in:
wp_xxyyzz
2016-07-02 09:20:00 +00:00
parent 998f2aa164
commit c4646eacb5

View File

@ -721,7 +721,7 @@ var
OldFont: TFont; OldFont: TFont;
RealPoint: TPoint; RealPoint: TPoint;
OldBrushStyle: TBrushStyle; OldBrushStyle: TBrushStyle;
savedFontHeight: Integer; // savedFontHeight: Integer;
begin begin
if not Assigned(FCanvas) then if not Assigned(FCanvas) then
raise EVpCanvasError.Create(RSNoCanvas); raise EVpCanvasError.Create(RSNoCanvas);
@ -758,8 +758,10 @@ begin
// Create new font to use // Create new font to use
OldFont := FCanvas.Font; OldFont := FCanvas.Font;
OldFont := TFont.Create;
try try
savedFontHeight := FCanvas.Font.Height; OldFont.Assign(FCanvas.Font);
// savedFontHeight := FCanvas.Font.Height;
FCanvas.Font.Handle:= CreateFontIndirect(LF); FCanvas.Font.Handle:= CreateFontIndirect(LF);
// Output the text // Output the text
@ -775,8 +777,9 @@ begin
FCanvas.Brush.Style := OldBrushStyle; FCanvas.Brush.Style := OldBrushStyle;
end; end;
finally finally
FCanvas.Font := OldFont; FCanvas.Font.Assign(OldFont);
FCanvas.Font.Height := savedFontHeight; // FCanvas.Font := OldFont;
// FCanvas.Font.Height := savedFontHeight;
end; end;
end; end;