Commit cb496bd
Merge stroke parts
Changed files (3)
modifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/ForesightTool.valamodifiedlibbirdfont/StrokeTool.vala
Diff
@@ -749,8 +749,8 @@ public class DrawingTools : ToolCollection { print (@"select $(StrokeTool.add_stroke)\n"); });- - stroke_expander.add_tool (add_stroke); + stroke_expander.add_tool (add_stroke);+ add_stroke.selected = StrokeTool.add_stroke; // edit stroke width object_stroke = new SpinButton ("object_stroke", t_("Stroke width"));@@ -778,6 +778,8 @@ public class DrawingTools : ToolCollection { f = BirdFont.get_current_font (); f.settings.set_setting ("stroke_width", object_stroke.get_display_value ());+ + GlyphCanvas.redraw (); }); stroke_expander.add_tool (object_stroke); @@ -305,6 +305,7 @@ public class ForesightTool : Tool { key_release_action.connect ((self, keyval) => { Tool p = PointTool.pen (); p.key_release_action (p, keyval);+ MainWindow.set_cursor (NativeWindow.VISIBLE); }); draw_action.connect ((tool, cairo_context, glyph) => {@@ -388,8 +389,6 @@ public class ForesightTool : Tool { if (PenTool.active_path.points.size > 1) { last = PenTool.active_path.points.get (PenTool.active_path.points.size - 2); last.convert_to_curve ();- - print (@"Before $(last.x) $(last.y)\n"); } } @@ -403,8 +402,6 @@ public class ForesightTool : Tool { if (PenTool.active_path.points.size > 0) { last = PenTool.active_path.points.get (PenTool.active_path.points.size - 1); last.convert_to_curve ();- - print (@"After $(last.x) $(last.y)\n"); } } @@ -111,8 +111,12 @@ public class StrokeTool : Tool { if (stroke_selected) {// FIXME: DELETE ((!) BirdFont.get_current_font ().get_glyph ("d")).add_path (p); }- } - remove_merged_parts (o);+ }+ + // FIXME: only on stroke to outline+ o = merge (o);+ + // remove_merged_parts (o); /* foreach (Path p in n.paths) {@@ -510,9 +514,6 @@ public class StrokeTool : Tool { distance = Path.distance_to_point (corner, original); ratio = 1.5 * fabs (adjusted_stroke) / distance; - print (@"$ratio $distance\n");- print (original.to_string ());- if (ratio > 1) { stroked.add_point (corner); } else {@@ -1355,8 +1356,6 @@ public class StrokeTool : Tool { foreach (Path p in r.paths) { c = counters (r, p); // FIXME: this needs improvements - print (@"$(p.points.size): $c $(is_clockwise (p))\n");- if (has_zero_area_segment (p)) { remove.add (p); }@@ -2067,7 +2066,8 @@ public class StrokeTool : Tool { double step_increment; double step_size; EditPoint corner1, corner1_inside;- + double min_step, max_step;+ side1 = new Path (); side2 = new Path (); @@ -2091,10 +2091,10 @@ public class StrokeTool : Tool { p1 = path.points.get (i % path.points.size); p2 = path.points.get ((i + 1) % path.points.size); p3 = path.points.get ((i + 2) % path.points.size);-- tolerance = 0.05 * stroke_width;+ + tolerance = 1.5 / sqrt (stroke_width); step_increment = 1.1;- step_size = 0.013;+ step_size = 0.039 / stroke_width; corner1 = new EditPoint (); @@ -2104,19 +2104,19 @@ public class StrokeTool : Tool { Path.get_point_for_step (p1, p2, step + step_size, out x2, out y2); Path.get_point_for_step (p1, p2, step + 2 * step_size, out x3, out y3); - flat = is_flat (x, y, x2, y2, x3, y3, tolerance); // FIXME: stroke_width+ flat = is_flat (x, y, x2, y2, x3, y3, tolerance); Path.get_point_for_step (p1, p2, step, out x, out y); Path.get_point_for_step (p1, p2, step + step_size / step_increment, out x2, out y2); Path.get_point_for_step (p1, p2, step + 2 * step_size / step_increment, out x3, out y3); - f_next = is_flat (x, y, x2, y2, x3, y3, tolerance); // FIXME: stroke_width+ f_next = is_flat (x, y, x2, y2, x3, y3, tolerance); Path.get_point_for_step (p1, p2, step, out x, out y); Path.get_point_for_step (p1, p2, step + step_size * step_increment, out x2, out y2); Path.get_point_for_step (p1, p2, step + 2 * step_size * step_increment, out x3, out y3); - f_bigger = is_flat (x, y, x2, y2, x3, y3, tolerance); // FIXME: stroke_width+ f_bigger = is_flat (x, y, x2, y2, x3, y3, tolerance); if (!flat && !f_next && step_size > 0.013) { step_size /= step_increment;