Clone in a terminal:
Commit f43866c
Johan Mattsson - 2013-02-08T12:34:00+00:00
f43866ceb9b250552d3470f938f6b428903b12afjohan.mattsson.m@gmail.com

parse nested layers in SVG files

Changed files (2)

Diff

diff --git a/TRANSLATORS b/TRANSLATORSindex d6a6ad5..2c29708 100644--- a/TRANSLATORS+++ b/TRANSLATORS@@ -5,3 +5,4 @@ Manuela Silva Zhantong Zhang Johan Mattsson Paul Pricootz+Adolfo Jayme Barrientosdiff --git a/libbirdfont/ImportSvg.vala b/libbirdfont/ImportSvg.valaindex cbefe4e..235c593 100644--- a/libbirdfont/ImportSvg.vala+++ b/libbirdfont/ImportSvg.vala@@ -129,6 +129,10 @@ public class ImportSvg { 			if (iter->name == "path") { 				parse_path (iter); 			}+			+			if (iter->name == "g") {+				parse_layer (iter);+			} 		} 	} 	@@ -200,7 +204,7 @@ public class ImportSvg { 		 		// parse path 		for (int i = 0; i < c.length; i++) {-+			 			if (c[i] == "m") { 				while (is_point (c[i + 1])) { 					command[ci++] = "M";@@ -517,8 +521,13 @@ public class ImportSvg { 		return double.parse ((!) s); 	} 	-	static bool is_point (string s) {-		return double.try_parse (s);+	static bool is_point (string? s) {+		if (s == null) {+			warning ("s is null");+			return false;+		}+		+		return double.try_parse ((!) s); 	} } 

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112