Skip to content

Commit cc3d3f7

Browse files
committed
The GetBitmapTextSize function used Math.round on the values, if the round parameter was true, which didn't create integers. It now uses Math.ceil instead to give integer results.
1 parent 8413896 commit cc3d3f7

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

src/gameobjects/bitmaptext/GetBitmapTextSize.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ var GetBitmapTextSize = function (src, round, out)
152152
h: current.h * sy,
153153
cr: false
154154
});
155-
155+
156156
current = null;
157157
}
158158
}
@@ -355,7 +355,7 @@ var GetBitmapTextSize = function (src, round, out)
355355
w: current.w * sx,
356356
h: current.h * sy
357357
});
358-
358+
359359
current = null;
360360
}
361361
}
@@ -422,20 +422,22 @@ var GetBitmapTextSize = function (src, round, out)
422422

423423
if (round)
424424
{
425-
local.x = Math.round(local.x);
426-
local.y = Math.round(local.y);
427-
local.width = Math.round(local.width);
428-
local.height = Math.round(local.height);
429-
430-
global.x = Math.round(global.x);
431-
global.y = Math.round(global.y);
432-
global.width = Math.round(global.width);
433-
global.height = Math.round(global.height);
434-
435-
lines.shortest = Math.round(shortestLine);
436-
lines.longest = Math.round(longestLine);
425+
local.x = Math.ceil(local.x);
426+
local.y = Math.ceil(local.y);
427+
local.width = Math.ceil(local.width);
428+
local.height = Math.ceil(local.height);
429+
430+
global.x = Math.ceil(global.x);
431+
global.y = Math.ceil(global.y);
432+
global.width = Math.ceil(global.width);
433+
global.height = Math.ceil(global.height);
434+
435+
lines.shortest = Math.ceil(shortestLine);
436+
lines.longest = Math.ceil(longestLine);
437437
}
438438

439+
// console.log(round, local);
440+
439441
out.words = words;
440442
out.lines.height = lineHeight;
441443
out.scaleX = src.scaleX;

0 commit comments

Comments
 (0)