Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Modules/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function __construct(Manager $manager)
*
* @param string $family
* @param string $style
* @param string $size
* @param string|int|float $size
* @throws \InvalidArgumentException
*/
public function set($family, $style, $size)
Expand Down Expand Up @@ -138,7 +138,12 @@ public function set($family, $style, $size)
}

$this->fontState->font = $this->fonts[$fontKey];
if ($size !== '') {
if ($size !== 0) {
if (is_string($size) && \ctype_digit($size)) {
$size = (int) $size;
} elseif (!\is_int($size)) {
$size = (float) $size;
}
$this->fontState->fontSize = $size;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/SetaFpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -624,24 +624,24 @@ public function SetFillColor(...$components)
* font size, it is simpler to call SetFontSize().
*
* @param string $family Family font. It can be either a name defined by AddFont() or one of the
* standard families (case insensitive):
* standard families (case-insensitive):
* Courier: (fixed with)
* Helvetica or Arial: (synonymous; sans serif)
* Times: (serif)
* Symbol: (symbolic)
* ZapfDingbats: (symbolic)
* It is also possible to pass an empty string. In that case, the current family is kept.
* @param string $style Font style. Possible values are (case insensitive):
* @param string $style Font style. Possible values are (case-insensitive):
* empty string: regular
* B: bold
* I: italic
* U: underline
* or any combination. The default value is regular. Bold and italic styles do not apply to
* Symbol and ZapfDingbats.
* @param string $size Font size in points. The default value is the current size. If no size has been specified
* since the beginning of the document, the value taken is 12.
* @param string|int|float $size Font size in points. The default value is the current size. If no size has been
* specified since the beginning of the document, the value taken is 12.
*/
public function SetFont($family, $style = '', $size = '')
public function SetFont($family, $style = '', $size = 0)
{
$this->manager->getFont()->set($family, $style, $size);
}
Expand Down