mirror of
https://github.com/Intervention/image.git
synced 2025-08-20 04:31:24 +02:00
498_fix_text_top_vertical_position_multiline_imagick
This commit is contained in:
@@ -56,17 +56,18 @@ class Font extends \Intervention\Image\AbstractFont
|
|||||||
// align vertical
|
// align vertical
|
||||||
if (strtolower($this->valign) != 'bottom') {
|
if (strtolower($this->valign) != 'bottom') {
|
||||||
|
|
||||||
// calculate box size
|
|
||||||
$dimensions = $image->getCore()->queryFontMetrics($draw, $this->text);
|
|
||||||
|
|
||||||
// corrections on y-position
|
// corrections on y-position
|
||||||
switch (strtolower($this->valign)) {
|
switch (strtolower($this->valign)) {
|
||||||
case 'center':
|
case 'center':
|
||||||
case 'middle':
|
case 'middle':
|
||||||
|
// calculate box size
|
||||||
|
$dimensions = $image->getCore()->queryFontMetrics($draw, $this->text);
|
||||||
$posy = $posy + $dimensions['textHeight'] * 0.65 / 2;
|
$posy = $posy + $dimensions['textHeight'] * 0.65 / 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'top':
|
case 'top':
|
||||||
|
// calculate box size
|
||||||
|
$dimensions = $image->getCore()->queryFontMetrics($draw, $this->text, false);
|
||||||
$posy = $posy + $dimensions['textHeight'] * 0.65;
|
$posy = $posy + $dimensions['textHeight'] * 0.65;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user