The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Fix zero length handles

These changes was commited to the Birdfont repository Sun, 01 Nov 2015 16:13:35 +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>
Sun, 01 Nov 2015 16:13:35 +0000 (17:13 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sun, 01 Nov 2015 16:28:36 +0000 (17:28 +0100)
commit 0417863cf3c7b9702d3730895edf08a72201ddc3
tree b70f89159ab875f8ff1415bf5085e8a1e770e87b
parent 5c0aac7892ae8750ea4aaa6b2cc4469a08dacce3
Fix zero length handles

libbirdfont/BezierTool.vala
--- a/libbirdfont/BezierTool.vala +++ b/libbirdfont/BezierTool.vala @@ -244,7 +244,6 @@ public void release (int b, int x, int y) { double px, py; Glyph g; - EditPoint first, last; if (!button_down) { warning ("Discarding event."); @@ -295,24 +294,30 @@ current_path.force_direction (Direction.COUNTER_CLOCKWISE); } else { current_path.force_direction (Direction.CLOCKWISE); - } - - first = current_path.get_first_point (); - if (first.get_right_handle ().length == 0) { - first.convert_to_line (); - } - - last = current_path.get_last_point (); - if (last.get_left_handle ().length == 0) { - last.convert_to_line (); } current_path.reset_stroke (); state = NONE; } + + convert_zero_length_handles_to_lines (); } + void convert_zero_length_handles_to_lines () { + EditPoint first, last; + + first = current_path.get_first_point (); + if (first.get_right_handle ().length == 0) { + first.convert_to_line (); + } + + last = current_path.get_last_point (); + if (last.get_left_handle ().length == 0) { + last.convert_to_line (); + } + } + public void move (int x, int y) { double px, py;