From 7adb4306ec929b1cef7afafe47f953cd839ad9bb Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 12 Sep 2005 19:38:09 +0000 Subject: [PATCH] * Fix scaling of non-integer SVG unit sizes --- RELEASE-NOTES | 1 + includes/Image.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a7f514ff94..0e4773bbcd 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -93,6 +93,7 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 3127) Render large SVGs at image page size correctly * Fix regressions in ChangesList traditional layout * Fix edit on double-click for move-protected pages in Classic skin +* Fix scaling of non-integer SVG unit sizes === Caveats === diff --git a/includes/Image.php b/includes/Image.php index 39acf98483..4bf542e00f 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -1670,7 +1670,7 @@ function wfScaleSVGUnit( $length ) { '' => 1.0, // "User units" pixels by default '%' => 2.0, // Fake it! ); - if( preg_match( '/^(\d+)(em|ex|px|pt|pc|cm|mm|in|%|)$/', $length, $matches ) ) { + if( preg_match( '/^(\d+(?:\.\d+)?)(em|ex|px|pt|pc|cm|mm|in|%|)$/', $length, $matches ) ) { $length = floatval( $matches[1] ); $unit = $matches[2]; return round( $length * $unitLength[$unit] ); -- 2.20.1