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