@@ -937,25 +937,25 @@ public function writeTextAndGetBoundingBox(string $string, string $fontPath, int
937
937
* @param $font
938
938
* @param $text
939
939
* @param int $spacing
940
- * @return array|false
940
+ * @return array
941
941
*/
942
- private function imagettftextWithSpacing ($ image , $ size , $ angle , $ x , $ y , $ color , $ font , $ text , int $ spacing = 0 )
942
+ private function imagettftextWithSpacing ($ image , float $ size , float $ angle , float $ x , float $ y , int $ color , string $ font , string $ text , int $ spacing = 0 )
943
943
{
944
944
if ($ spacing == 0 )
945
945
{
946
- return imagettftext ($ image , $ size , $ angle , $ x , $ y , $ color , $ font , $ text );
946
+ return \ imagettftext ($ image , $ size , $ angle , $ x , $ y , $ color , $ font , $ text );
947
947
}
948
948
else
949
949
{
950
950
$ temp_x = $ x ;
951
951
$ temp_y = $ y ;
952
- $ posText = false ;
953
- for ($ i = 0 ; $ i < strlen ($ text ); $ i ++ )
952
+ $ posText = [] ;
953
+ for ($ i = 0 ; $ i < \mb_strlen ($ text ); ++ $ i )
954
954
{
955
- $ posText = imagettftext ($ image , $ size , $ angle , $ temp_x , $ temp_y , $ color , $ font , $ text [$ i ]);
956
- $ bbox = imagettfbbox ($ size , 0 , $ font , $ text [$ i ]);
957
- $ temp_x += cos (deg2rad ($ angle )) * ($ spacing + ($ bbox [2 ] - $ bbox [0 ]));
958
- $ temp_y -= sin (deg2rad ($ angle )) * ($ spacing + ($ bbox [2 ] - $ bbox [0 ]));
955
+ $ posText = \ imagettftext ($ image , $ size , $ angle , $ temp_x , $ temp_y , $ color , $ font , $ text [$ i ]);
956
+ $ bbox = \ imagettfbbox ($ size , 0 , $ font , $ text [$ i ]);
957
+ $ temp_x += \ cos (\ deg2rad ($ angle )) * ($ spacing + ($ bbox [2 ] - $ bbox [0 ]));
958
+ $ temp_y -= \ sin (\ deg2rad ($ angle )) * ($ spacing + ($ bbox [2 ] - $ bbox [0 ]));
959
959
}
960
960
return $ posText ;
961
961
}
0 commit comments