The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Merge stroke parts

These changes was commited to the Birdfont repository Mon, 27 Apr 2015 18:03:39 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 27 Apr 2015 18:03:39 +0000 (20:03 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 27 Apr 2015 18:03:39 +0000 (20:03 +0200)
commit cb496bd985d28a43fd49b14f6ee638c362188c4d
tree 552b4dca618ce396b038aceac44d587c3e844624
parent f8dcfd80b34affc36c53ce478202479d36c7088f
Merge stroke parts

libbirdfont/DrawingTools.vala
libbirdfont/ForesightTool.vala
libbirdfont/StrokeTool.vala
--- a/libbirdfont/DrawingTools.vala +++ b/libbirdfont/DrawingTools.vala @@ -749,8 +749,8 @@ 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 @@ f = BirdFont.get_current_font (); f.settings.set_setting ("stroke_width", object_stroke.get_display_value ()); + + GlyphCanvas.redraw (); }); stroke_expander.add_tool (object_stroke);
--- a/libbirdfont/ForesightTool.vala +++ b/libbirdfont/ForesightTool.vala @@ -305,6 +305,7 @@ 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 @@ 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 @@ 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"); } }
--- a/libbirdfont/StrokeTool.vala +++ b/libbirdfont/StrokeTool.vala @@ -111,8 +111,12 @@ 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) { @@ -509,9 +513,6 @@ 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); @@ -1354,8 +1355,6 @@ 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 @@ 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 @@ 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 @@ 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;