From d05df1c7b33f9c1d02ca1fddf10fa1075098ecf5 Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Mon, 3 Dec 2018 23:26:00 +0900 Subject: [PATCH] Fix stroke-width calculation for non-px units --- svg2mod/svg2mod.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/svg2mod/svg2mod.py b/svg2mod/svg2mod.py index cc3f060..91cc1ed 100755 --- a/svg2mod/svg2mod.py +++ b/svg2mod/svg2mod.py @@ -491,8 +491,11 @@ def _get_fill_stroke( self, item ): stroke = False elif name == "stroke-width": - value = value.replace( "px", "" ) - stroke_width = float( value ) * 25.4 / float(self.dpi) + if value.endswith("px"): + value = value.replace( "px", "" ) + stroke_width = float( value ) * 25.4 / float(self.dpi) + else: + stroke_width = float( value ) if not stroke: stroke_width = 0.0