1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-18 03:31:19 +02:00

Add doc blocks

This commit is contained in:
Oliver Vogel
2024-01-28 17:03:57 +01:00
parent 1aa8869e50
commit e57ba4224f

View File

@@ -94,11 +94,21 @@ class TextModifier extends AbstractTextModifier
return $polygon; return $polygon;
} }
/**
* Calculate font size for `imagettftext` from given font size
*
* @return float
*/
private function adjustedFontSize(): float private function adjustedFontSize(): float
{ {
return floatval(ceil($this->font->size() * .75)); return floatval(ceil($this->font->size() * .75));
} }
/**
* Return GD's internal font size (if no ttf file is set)
*
* @return int
*/
private function getGdFont(): int private function getGdFont(): int
{ {
if (is_numeric($this->font->filename())) { if (is_numeric($this->font->filename())) {
@@ -108,11 +118,21 @@ class TextModifier extends AbstractTextModifier
return 1; return 1;
} }
/**
* Font width to calculate box size, only applicable when no ttf file is set
*
* @return int
*/
private function getGdFontWidth(): int private function getGdFontWidth(): int
{ {
return $this->getGdFont() + 4; return $this->getGdFont() + 4;
} }
/**
* Font height to calculate box size, only applicable when no ttf file is set
*
* @return int
*/
private function getGdFontHeight(): int private function getGdFontHeight(): int
{ {
switch ($this->getGdFont()) { switch ($this->getGdFont()) {