浏览代码

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

git-svn-id: trunk@14976 -
marco 15 年之前
父节点
当前提交
502ac4c8a5
共有 1 个文件被更改,包括 4 次插入1 次删除
  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
   if inheritsFrom (TFPCustomDrawFont) then
     result := TFPCustomDrawFont(self).DoGetTextWidth (text)
     result := TFPCustomDrawFont(self).DoGetTextWidth (text)
   else
   else
-    result := FCanvas.GetTextWidth (text);
+   if assigned(FCanvas) then
+     result := FCanvas.GetTextWidth (text)
+   else 
+     result :=16; // *some* default better than none.
 end;
 end;