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;
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;