aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/UFont.pas
diff options
context:
space:
mode:
authors_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-09 07:41:42 +0000
committers_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-11-09 07:41:42 +0000
commit5770b03c014bffe3318b96dcb935ff3438fd12fa (patch)
treebbbcf8eb5580aa3e04013acdd86826cfd05cfb50 /src/base/UFont.pas
parent917901e8e33438c425aef50a0a7417f32d77b760 (diff)
downloadusdx-5770b03c014bffe3318b96dcb935ff3438fd12fa.tar.gz
usdx-5770b03c014bffe3318b96dcb935ff3438fd12fa.tar.xz
usdx-5770b03c014bffe3318b96dcb935ff3438fd12fa.zip
fixed div 0 errors
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1940 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base/UFont.pas')
-rw-r--r--src/base/UFont.pas16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/base/UFont.pas b/src/base/UFont.pas
index 72409ac1..191e74d2 100644
--- a/src/base/UFont.pas
+++ b/src/base/UFont.pas
@@ -1167,12 +1167,22 @@ begin
// projected width ||(x1, y1) - (x2, y1)||
Dist := (WinCoords[0][0] - WinCoords[1][0]);
Dist2 := (WinCoords[0][1] - WinCoords[1][1]);
- WidthScale := cTestSize / Sqrt(Dist*Dist + Dist2*Dist2);
+
+ WidthScale := 1;
+ if (Sqrt(Dist*Dist + Dist2*Dist2) <> 0) then
+ begin
+ WidthScale := cTestSize / Sqrt(Dist*Dist + Dist2*Dist2);
+ end;
// projected height ||(x1, y1) - (x1, y2)||
Dist := (WinCoords[0][0] - WinCoords[2][0]);
Dist2 := (WinCoords[0][1] - WinCoords[2][1]);
- HeightScale := cTestSize / Sqrt(Dist*Dist + Dist2*Dist2);
+
+ HeightScale := 1;
+ if (Sqrt(Dist*Dist + Dist2*Dist2) <> 0) then
+ begin
+ HeightScale := cTestSize / Sqrt(Dist*Dist + Dist2*Dist2);
+ end;
//writeln(Format('Scale %f, %f', [WidthScale, HeightScale]));
@@ -1326,7 +1336,7 @@ var
Level: integer;
begin
for Level := 0 to High(fMipmapFonts) do
- if (fMipmapFonts[Level] <> nil) then
+ if ((fMipmapFonts[Level] <> nil) AND (GetMipmapScale(Level) > 0)) then
fMipmapFonts[Level].SetReflectionSpacing(Spacing / GetMipmapScale(Level));
end;