mirror of
https://github.com/Intervention/image.git
synced 2025-08-11 16:34:00 +02:00
Fix bugs
This commit is contained in:
@@ -15,22 +15,25 @@ class Font extends AbstractFont
|
|||||||
{
|
{
|
||||||
use CanHandleColors;
|
use CanHandleColors;
|
||||||
|
|
||||||
public function toImagickDraw(ColorspaceInterface $colorspace): ImagickDraw
|
public function toImagickDraw(?ColorspaceInterface $colorspace = null): ImagickDraw
|
||||||
{
|
{
|
||||||
if (!$this->hasFilename()) {
|
if (!$this->hasFilename()) {
|
||||||
throw new FontException('No font file specified.');
|
throw new FontException('No font file specified.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$color = $this->colorToPixel($this->getColor(), $colorspace);
|
|
||||||
|
|
||||||
$draw = new ImagickDraw();
|
$draw = new ImagickDraw();
|
||||||
$draw->setStrokeAntialias(true);
|
$draw->setStrokeAntialias(true);
|
||||||
$draw->setTextAntialias(true);
|
$draw->setTextAntialias(true);
|
||||||
$draw->setFont($this->getFilename());
|
$draw->setFont($this->getFilename());
|
||||||
$draw->setFontSize($this->getSize());
|
$draw->setFontSize($this->getSize());
|
||||||
$draw->setFillColor($color);
|
|
||||||
$draw->setTextAlignment(Imagick::ALIGN_LEFT);
|
$draw->setTextAlignment(Imagick::ALIGN_LEFT);
|
||||||
|
|
||||||
|
if ($colorspace) {
|
||||||
|
$draw->setFillColor(
|
||||||
|
$this->colorToPixel($this->getColor(), $colorspace)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $draw;
|
return $draw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ trait CanHandleColors
|
|||||||
* the image colorspace which is passed to this method.
|
* the image colorspace which is passed to this method.
|
||||||
*
|
*
|
||||||
* @param ColorInterface $color
|
* @param ColorInterface $color
|
||||||
* @param ColorspceInterface $colorspace
|
* @param ColorspaceInterface $colorspace
|
||||||
* @return ImagickPixel
|
* @return ImagickPixel
|
||||||
*/
|
*/
|
||||||
public function colorToPixel(ColorInterface $color, ColorspaceInterface $colorspace): ImagickPixel
|
public function colorToPixel(ColorInterface $color, ColorspaceInterface $colorspace): ImagickPixel
|
||||||
|
Reference in New Issue
Block a user