@@ -380,7 +380,7 @@ private function convertPosX($posX, int $width = 0): int
380
380
case static ::ALIGN_LEFT :
381
381
return 0 ;
382
382
case static ::ALIGN_CENTER :
383
- return $ this ->width / 2 - $ width / 2 ;
383
+ return \round ( $ this ->width / 2 - $ width / 2 ) ;
384
384
case static ::ALIGN_RIGHT :
385
385
return $ this ->width - $ width ;
386
386
}
@@ -400,7 +400,7 @@ private function convertPosY($posY, int $height = 0): int
400
400
case static ::ALIGN_TOP :
401
401
return 0 ;
402
402
case static ::ALIGN_MIDDLE :
403
- return $ this ->height / 2 - $ height / 2 ;
403
+ return \round ( $ this ->height / 2 - $ height / 2 ) ;
404
404
case static ::ALIGN_BOTTOM :
405
405
return $ this ->height - $ height ;
406
406
}
@@ -960,7 +960,7 @@ public function writeTextAndGetBoundingBox(string $string, string $fontPath, flo
960
960
private function imagettftextWithSpacing ($ image , float $ size , float $ angle , float $ x , float $ y , int $ color , string $ font , string $ text , float $ spacing = 0 )
961
961
{
962
962
if ($ spacing == 0 ) {
963
- return \imagettftext ($ image , $ size , $ angle , $ x , $ y , $ color , $ font , $ text );
963
+ return \imagettftext ($ image , $ size , $ angle , \round ( $ x ), \round ( $ y ) , $ color , $ font , $ text );
964
964
} else {
965
965
$ length = \mb_strlen ($ text );
966
966
@@ -975,7 +975,7 @@ private function imagettftextWithSpacing($image, float $size, float $angle, floa
975
975
976
976
for ($ i = 0 ; $ i < $ length ; ++$ i ) {
977
977
$ char = \mb_substr ($ text , $ i , 1 );
978
- \imagettftext ($ image , $ size , $ angle , $ letterPos ['x ' ], $ letterPos ['y ' ], $ color , $ font , $ char );
978
+ \imagettftext ($ image , $ size , $ angle , \round ( $ letterPos ['x ' ]), \round ( $ letterPos ['y ' ]) , $ color , $ font , $ char );
979
979
$ bbox = \imagettfbbox ($ size , 0 , $ font , $ char );
980
980
$ letterPos = Geometry2D::getDstXY ($ letterPos ['x ' ], $ letterPos ['y ' ], $ angle , $ spacing + $ bbox [2 ]);
981
981
0 commit comments