Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Caban committed Sep 24, 2020
1 parent e819e0c commit 94bdea9
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public function applyToImage(Image $image, $posx = 0, $posy = 0)
switch ($align.'-'.$valign) {

case 'center-top':
$posx -= round(($box[6] + $box[4])/2);
$posy -= round(($box[7] + $box[5])/2);
$posx -= round(($box[6] + $box[4]) / 2);
$posy -= round(($box[7] + $box[5]) / 2);
break;

case 'right-top':
Expand All @@ -97,25 +97,25 @@ public function applyToImage(Image $image, $posx = 0, $posy = 0)

case 'center-center':
case 'center-middle':
$posx -= round(($box[0] + $box[4])/2);
$posy -= round(($box[1] + $box[5])/2);
$posx -= round(($box[0] + $box[4]) / 2);
$posy -= round(($box[1] + $box[5]) / 2);
break;

case 'right-center':
case 'right-middle':
$posx -= round(($box[2] + $box[4])/2);
$posy -= round(($box[3] + $box[5])/2);
$posx -= round(($box[2] + $box[4]) / 2);
$posy -= round(($box[3] + $box[5]) / 2);
break;

case 'left-center':
case 'left-middle':
$posx -= round(($box[0] + $box[6])/2);
$posy -= round(($box[1] + $box[7])/2);
$posx -= round(($box[0] + $box[6]) / 2);
$posy -= round(($box[1] + $box[7]) / 2);
break;

case 'center-bottom':
$posx -= round(($box[0] + $box[2])/2);
$posy -= round(($box[1] + $box[3])/2);
$posx -= round(($box[0] + $box[2]) / 2);
$posy -= round(($box[1] + $box[3]) / 2);
break;

case 'right-bottom':
Expand Down Expand Up @@ -169,19 +169,18 @@ public function getBoxSize()
$box = [
$core->xoffset,
$core->height,
$core->width+$core->xoffset,
$core->width + $core->xoffset,
$core->height,
$core->width+$core->xoffset,
$core->width + $core->xoffset,
0,
$core->xoffset,
0
0,
];

if ($this->angle !== 0) {

$angle = deg2rad(360 - $this->angle);

for ($i=0; $i<4; $i++) {
for ($i = 0; $i < 4; $i++) {
$x = $box[$i * 2];
$y = $box[$i * 2 + 1];
$box[$i * 2] = cos($angle) * $x - sin($angle) * $y;
Expand Down

0 comments on commit 94bdea9

Please sign in to comment.