Clone in a terminal:
Commit d1688c8
Johan Mattsson - 2015-11-07T12:42:33+00:00
d1688c813e8b2761fe69982c69da5c9b7e3f4882johan.mattsson.m@gmail.com

Set minimum stroke with to 0.02

Changed files (8)

Diff

diff --git a/libbirdfont/BirdFontFile.vala b/libbirdfont/BirdFontFile.valaindex ad43656..11f9104 100644--- a/libbirdfont/BirdFontFile.vala+++ b/libbirdfont/BirdFontFile.vala@@ -1400,7 +1400,7 @@ class BirdFontFile : GLib.Object {  		foreach (Attribute attr in tag.get_attributes ()) { 			if (attr.get_name () == "stroke") {-				path.set_stroke (double.parse (attr.get_content ()));+				path.stroke = double.parse (attr.get_content ()); 			}  			if (attr.get_name () == "skew") {diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex ae5994a..880959b 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -806,6 +806,7 @@ public class DrawingTools : ToolCollection  { 				 		// add stroke to path 		add_stroke = new Tool ("apply_stroke", t_("Apply stroke"));+ 		add_stroke.select_action.connect ((self) => { 			Font f; 			Glyph g = MainWindow.get_current_glyph ();@@ -856,7 +857,7 @@ public class DrawingTools : ToolCollection  { 				|| bezier_tool.is_selected (); 			 			StrokeTool.stroke_width = object_stroke.get_value ();-			+					 			if (tool && StrokeTool.add_stroke) { 				foreach (Path p in g.active_paths) { 					p.stroke = StrokeTool.stroke_width;diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex be58fff..8fbddcf 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -214,7 +214,7 @@ public class Glyph : FontDisplay {  		foreach (Path p in get_visible_paths ()) { 			if (p.stroke > 0) {-				stroke = p.get_stroke ();+				stroke = p.get_completed_stroke (); 				foreach (Path stroke_part in stroke.paths) { 					pc = new PointConverter (stroke_part); 					pl.add (pc.get_quadratic_path ());diff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex 9bc16a4..1a549ef 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -51,7 +51,22 @@ public class Path : GLib.Object { 	public double ymin = Glyph.CANVAS_MAX;  	/** Stroke width */-	public double stroke = 0;+	public double stroke {+		get {+			return path_stroke_width;+		}+		+		set {+			if (0 < value < 0.1) {+				path_stroke_width = 0.2;+			} else {+				path_stroke_width = value;+			}+		}+	}+	+	private double path_stroke_width = 0;+	 	public LineCap line_cap = LineCap.BUTT; 	public PathList? full_stroke = null; 	PathList? fast_stroke = null;@@ -158,10 +173,6 @@ public class Path : GLib.Object { 		return points.size == 0; 	} -	public void set_stroke (double width) {-		stroke = width;	-	}- 	public void draw_boundaries  (Context cr) { 		double x = Glyph.reverse_path_coordinate_x (xmin);  		double y = Glyph.reverse_path_coordinate_y (ymin);@@ -2456,7 +2467,7 @@ public class Path : GLib.Object { 		}	 	} -	public PathList get_stroke () {+	public PathList get_completed_stroke () { 		if (full_stroke == null) { 			StrokeTool s = new StrokeTool (); 			full_stroke = s.get_stroke (this, stroke);diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex bb7b495..60dedb8 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -1846,7 +1846,7 @@ public class PenTool : Tool { 			np.add (xt, yt); 			 			if (DrawingTools.pen_tool.is_selected ()) {-				np.set_stroke (PenTool.path_stroke_width);+				np.stroke = PenTool.path_stroke_width; 			} 			 			PenTool.active_path = np;diff --git a/libbirdfont/StrokeTool.vala b/libbirdfont/StrokeTool.valaindex ce111e1..6038c51 100644--- a/libbirdfont/StrokeTool.vala+++ b/libbirdfont/StrokeTool.vala@@ -53,7 +53,7 @@ public class StrokeTool : GLib.Object { 		 		foreach (Path p in g.active_paths) { 			if (p.stroke > 0) {-				paths.append (p.get_stroke ());+				paths.append (p.get_completed_stroke ()); 			} 		} @@ -138,7 +138,7 @@ public class StrokeTool : GLib.Object { 			if (p.stroke == 0) { 				o.add (p); 			} else {-				o.append (p.get_stroke ());+				o.append (p.get_completed_stroke ()); 			} 		} 						diff --git a/libbirdfont/Svg.vala b/libbirdfont/Svg.valaindex 6cddb54..33a94b2 100644--- a/libbirdfont/Svg.vala+++ b/libbirdfont/Svg.vala@@ -27,7 +27,7 @@ public class Svg { 			if (p.stroke == 0) { 				write_path_as_glyph (p, svg, g); 			} else {-				stroke_list = p.get_stroke ();+				stroke_list = p.get_completed_stroke (); 				write_paths_as_glyph (stroke_list, svg, g); 			} 		}diff --git a/libbirdfont/TestCases.vala b/libbirdfont/TestCases.valaindex 8b83fef..b34e9af 100644--- a/libbirdfont/TestCases.vala+++ b/libbirdfont/TestCases.vala@@ -173,7 +173,7 @@ class TestCases { 		glyph = MainWindow.get_current_glyph (); 		for (int i = 0; i < 5; i++) { 			foreach (Path p in glyph.get_all_paths ()) {-				p.set_stroke (i / 100.0);+				p.stroke = (i / 100.0); 				glyph.update_view (); 				Tool.yield (); 			}

Contact

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