summaryrefslogtreecommitdiff
path: root/docview/components/richtext
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-08-06 17:05:02 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-08-06 17:05:02 +0200
commit9d9a86d39d3f22ea6db81729c1efc60ef55e0b83 (patch)
tree224f36377dba31582f4e1145a29f471bdfe1b8b9 /docview/components/richtext
parentb4613083657e721533f12dfc86a6dc2cb833bf71 (diff)
downloadfpGUI-9d9a86d39d3f22ea6db81729c1efc60ef55e0b83.tar.xz
docview: Fixed mono font screwup when scrolling large tables.
When scrolling pages that contain large tables of source code examples using mono fonts, it changed no non-mono fonts. This is now finally fixed!
Diffstat (limited to 'docview/components/richtext')
-rw-r--r--docview/components/richtext/CanvasFontManager.pas21
1 files changed, 13 insertions, 8 deletions
diff --git a/docview/components/richtext/CanvasFontManager.pas b/docview/components/richtext/CanvasFontManager.pas
index 8a15e914..7996c16d 100644
--- a/docview/components/richtext/CanvasFontManager.pas
+++ b/docview/components/richtext/CanvasFontManager.pas
@@ -924,11 +924,15 @@ var
lDefaultFontSpec: TFontSpec;
begin
ProfileEvent('DEBUG: TCanvasFontManager.SetFont >>>>');
- if (FCurrentFontSpec.FaceName = FontSpec.FaceName) and
- (FCurrentFontSpec.PointSize = FontSpec.PointSize) and
- (FCurrentFontSpec.Attributes = FontSpec.Attributes) then
- // same font
- exit;
+ // we don't need this any more, because we check FCurrentFont <> Font further down
+ // We also make sure we always set Canvas.Font - this fixes large display of Grids or Sample Code in Courier New font
+ //if (FCurrentFontSpec.FaceName = FontSpec.FaceName) and
+ // (FCurrentFontSpec.PointSize = FontSpec.PointSize) and
+ // (FCurrentFontSpec.Attributes = FontSpec.Attributes) then
+ // //same font
+ //begin
+ // exit;
+ //end;
Font := GetFont( FontSpec );
@@ -937,7 +941,7 @@ ProfileEvent('DEBUG: TCanvasFontManager.SetFont >>>>');
// ack! Pfffbt! Couldn't find the font.
// Try to get the default font
-// writeln('---------- here goes nothing -------------');
+ //writeln('---------- here goes nothing -------------');
Font := GetFont( FDefaultFontSpec );
if Font = nil then
begin
@@ -948,7 +952,7 @@ ProfileEvent('DEBUG: TCanvasFontManager.SetFont >>>>');
FPGuiFontToFontSpec( fpgApplication.DefaultFont, lDefaultFontSpec );
Font := GetFont( lDefaultFontSpec );
if Font = nil then
- // Jimminy! We can't even get the default system font
+ // WTF! We can't even get the default system font
raise Exception.Create( 'Could not access default font '
+ 'in place of '
+ FontSpec.FaceName
@@ -960,7 +964,8 @@ ProfileEvent('DEBUG: TCanvasFontManager.SetFont >>>>');
SelectFont( Font, 1 );
FCurrentFontSpec := FontSpec;
- FCurrentFont.Free;
+ if FCurrentFont <> Font then
+ FCurrentFont.Free;
FCurrentFont := Font;
ProfileEvent('DEBUG: TCanvasFontManager.SetFont <<<<');
end;