Browse Source

* another fix for mantis 13171, font.gettextwidth default value

git-svn-id: trunk@14976 -
marco 15 năm trước cách đây
mục cha
commit
502ac4c8a5
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      packages/fcl-image/src/fpfont.inc

+ 4 - 1
packages/fcl-image/src/fpfont.inc

@@ -65,6 +65,9 @@ begin
   if inheritsFrom (TFPCustomDrawFont) then
     result := TFPCustomDrawFont(self).DoGetTextWidth (text)
   else
-    result := FCanvas.GetTextWidth (text);
+   if assigned(FCanvas) then
+     result := FCanvas.GetTextWidth (text)
+   else 
+     result :=16; // *some* default better than none.
 end;