summaryrefslogtreecommitdiff
path: root/docview/components/richtext
diff options
context:
space:
mode:
Diffstat (limited to 'docview/components/richtext')
-rw-r--r--docview/components/richtext/CanvasFontManager.pas8
1 files changed, 7 insertions, 1 deletions
diff --git a/docview/components/richtext/CanvasFontManager.pas b/docview/components/richtext/CanvasFontManager.pas
index 54e9755e..9e9114ec 100644
--- a/docview/components/richtext/CanvasFontManager.pas
+++ b/docview/components/richtext/CanvasFontManager.pas
@@ -35,6 +35,7 @@ type
private
FWidget: TfpgWidget;
FCanvas: TfpgCanvas;
+ FFont: TfpgFont;
function GetCurrentFont: TfpgFont;
procedure SetDefaultFont(const AValue: TfpgFont);
protected
@@ -234,12 +235,14 @@ begin
FWidget := AWidget;
FDefaultFont := fpgGetFont(DefaultTopicFont);
FCanvas.Font := FDefaultFont;
+ FFont := nil;
end;
destructor TCanvasFontManager.Destroy;
begin
FCanvas.Font := fpgApplication.DefaultFont;
FDefaultFont.Free;
+ FFont.Free;
inherited Destroy;
end;
@@ -269,7 +272,10 @@ begin
Exit;
end;
- FCanvas.Font := fpgGetFont(AFontDesc);
+ if Assigned(FFont) then
+ FFont.Free;
+ FFont := fpgGetFont(AFontDesc);
+ FCanvas.Font := FFont;
end;
function TCanvasFontManager.CharWidth( const C: TfpgChar ): longint;