SVG::addFont(__DIR__ . '/font/Roboto-Bold.ttf');
$svg = new SVG(100, 100);
$text = new SVGText('foo', 50, 50);
$svg->getDocument()->addChild($text);
header('Content-Type: image/png');
imagepng($larvatar->toRasterImage(100, 100));
Error:
Fatal error:
Uncaught TypeError:
Argument 1 passed to SVG\Rasterization\Transform\Transform::resize() must be of the type float, null given,
called in php-svg\src\Rasterization\Renderers\TextRenderer.php on line 31
and defined in php-svg\src\Rasterization\Transform\Transform.php on line 94
Setting the font size explicitly fixes the problem:
$text->setStyle('font-size', '12pt');
There should be a default font size used, in case none is explicitly defined, to avoid this error.
The following code leads to an error:
Error:
Setting the font size explicitly fixes the problem:
There should be a default font size used, in case none is explicitly defined, to avoid this error.