All welcome, I apply a solution based on https://gist.github.com/clifgriffin/728 ... 7b81fa2d8a where a text block is set and the size of the text is automatically selected depending on the length of the text, download https://yadi.sk/d/KExniPdnz1N1cw .
1)It is necessary now that the text is centered inside the specified box and line, clearly here https://yadi.sk/i/iSkVEDfrOLs_uA
2) Also i want to rotate text correctly
Really looking forward to help on this solution for PHP 5.4.
How centering inside line and block with automatically selected font size
-
- Posts: 1
- Joined: 2019-01-17T01:44:40-07:00
- Authentication code: 1152
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How centering inside line and block with automatically selected font size
Sorry, I do not code Imagick. Best I can tell you is that in this line:
$NewImage->annotateImage( $draw, $x_pos, $y_pos + ($i * $line_height * $line_height_ratio), 0, $lines[$i] );
You need to compute the $x_pos, so that the text will be centered. Measure the text width and the image width and offset by half the difference.
$NewImage->annotateImage( $draw, $x_pos, $y_pos + ($i * $line_height * $line_height_ratio), 0, $lines[$i] );
You need to compute the $x_pos, so that the text will be centered. Measure the text width and the image width and offset by half the difference.