mirror of
https://github.com/Intervention/image.git
synced 2025-09-02 18:32:56 +02:00
Add position to typographic text line
This commit is contained in:
@@ -3,21 +3,29 @@
|
|||||||
namespace Intervention\Image\Typography;
|
namespace Intervention\Image\Typography;
|
||||||
|
|
||||||
use Intervention\Image\Interfaces\FontInterface;
|
use Intervention\Image\Interfaces\FontInterface;
|
||||||
|
use Intervention\Image\Geometry\Point;
|
||||||
|
|
||||||
class Line
|
class Line
|
||||||
{
|
{
|
||||||
|
protected $position;
|
||||||
|
|
||||||
public function __construct(protected string $text)
|
public function __construct(protected string $text)
|
||||||
{
|
{
|
||||||
//
|
$this->position = new Point();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString(): string
|
public function getPosition(): Point
|
||||||
{
|
{
|
||||||
return $this->text;
|
return $this->position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function width(FontInterface $font): int
|
public function width(FontInterface $font): int
|
||||||
{
|
{
|
||||||
return $font->getBoxSize($this->text)->width();
|
return $font->getBoxSize($this->text)->width();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __toString(): string
|
||||||
|
{
|
||||||
|
return $this->text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user