diff --git a/src/Svg/Tag/AbstractTag.php b/src/Svg/Tag/AbstractTag.php index 872d971..0dc06a9 100644 --- a/src/Svg/Tag/AbstractTag.php +++ b/src/Svg/Tag/AbstractTag.php @@ -225,11 +225,11 @@ protected function applyViewbox($attributes) { $eHeight = $attributes["height"] ?? $this->document->getHeight(); // 3. Let align be the align value of preserveAspectRatio, or 'xMidYMid' if preserveAspectRatio is not defined. - $preserveAspectRatio = explode(" ", $attributes["preserveAspectRatio"] ?? "xMidYMid meet"); + $preserveAspectRatio = explode(" ", $attributes["preserveaspectratio"] ?? "xMidYMid meet"); $align = $preserveAspectRatio[0]; // 4. Let meetOrSlice be the meetOrSlice value of preserveAspectRatio, or 'meet' if preserveAspectRatio is not defined or if meetOrSlice is missing from this value. - $meetOrSlice = $meetOrSlice ?? "meet"; + $meetOrSlice = $preserveAspectRatio[1] ?? "meet"; // 5. Initialize scale-x to e-width/vb-width. $scaleX = $vbWidth == 0 ? 0 : ($eWidth / $vbWidth); @@ -265,14 +265,14 @@ protected function applyViewbox($attributes) { $translateX += ($eWidth - $vbWidth * $scaleX); } - // 13. If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y. - if (strpos($align, "yMid") !== false) { - $translateX += ($eHeight - $vbHeight * $scaleY) / 2; + // 13. If align contains 'YMid', add (e-height - vb-height * scale-y) / 2 to translate-y. + if (strpos($align, "YMid") !== false) { + $translateY += ($eHeight - $vbHeight * $scaleY) / 2; } - // 14. If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y. - if (strpos($align, "yMid") !== false) { - $translateX += ($eHeight - $vbHeight * $scaleY); + // 14. If align contains 'YMax', add (e-height - vb-height * scale-y) to translate-y. + if (strpos($align, "YMax") !== false) { + $translateY += ($eHeight - $vbHeight * $scaleY); } $surface->translate($translateX, $translateY); diff --git a/src/Svg/Tag/Path.php b/src/Svg/Tag/Path.php index b792b3a..c3dd75f 100644 --- a/src/Svg/Tag/Path.php +++ b/src/Svg/Tag/Path.php @@ -448,7 +448,7 @@ function drawArc(SurfaceInterface $surface, $fx, $fy, $coords) $toX = $tx - $fx; $toY = $ty - $fy; - if ((float)($toX + $toY) === 0.0) { + if ((float)$toX === 0.0 && (float)$toY === 0.0) { return; }