The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Do logging in idle callback

These changes was commited to the Birdfont repository Tue, 06 Oct 2015 12:39:48 +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>
Tue, 06 Oct 2015 12:39:48 +0000 (14:39 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Tue, 06 Oct 2015 12:41:24 +0000 (14:41 +0200)
commit 0d70e67348bb812ac08618e3102ffe7263cb46d3
tree 5eac011c084a8e1e46c09a73198551572171644f
parent 1d97f93822c5d4ffd49a5af13efc82fd5aa553f9
Do logging in idle callback

libbirdfont/BirdFont.vala
libbirdfont/StrokeTool.vala
--- a/libbirdfont/BirdFont.vala +++ b/libbirdfont/BirdFont.vala @@ -732,19 +732,27 @@ #if ANDROID __android_log_print (ANDROID_LOG_WARN, "BirdFont", s); #else - if (unlikely (BirdFont.logging)) { - try { - if (BirdFont.logstream != null) { - ((!)BirdFont.logstream).put_string (s); - } else { - warning ("No logstream."); + IdleSource idle = new IdleSource (); + + idle.set_callback (() => { + if (unlikely (BirdFont.logging)) { + try { + if (BirdFont.logstream != null) { + ((!)BirdFont.logstream).put_string (s); + } else { + warning ("No logstream."); + } + + stderr.printf (s); + } catch (GLib.Error e) { + warning (e.message); } - - stderr.printf (s); - } catch (GLib.Error e) { - warning (e.message); } - } + + return false; + }); + + idle.attach (null); #endif }
--- a/libbirdfont/StrokeTool.vala +++ b/libbirdfont/StrokeTool.vala @@ -222,7 +222,7 @@ for (int i = 0; i < p.points.size; i++) { EditPoint ep = p.points.get (i); - if (fabs (ep.get_right_handle ().angle - ep.get_left_handle ().angle) < 0.001) { + if (fabs (ep.get_right_handle ().angle - ep.get_left_handle ().angle) % (2 * PI) < 0.01) { ps = new PointSelection (ep, p); PenTool.remove_point_simplify (ps); i--; @@ -946,13 +946,6 @@ PenTool.convert_point_type (e, PointType.CUBIC); } - foreach (EditPoint e in p.points) { - if ((e.flags & EditPoint.CURVE) == 0) { - p.set_new_start (e); - break; - } - } - for (int i = 0; i < p.points.size; i++) { ep = p.points.get (i); @@ -1342,7 +1335,7 @@ next_handle.angle += PI; Path.find_intersection_handle (previous_handle, next_handle, out corner_x, out corner_y); - corner = new EditPoint (corner_x, corner_y, previous.type); + corner = new EditPoint (corner_x, corner_y, PointType.CUBIC); corner.convert_to_line (); previous_handle.angle -= PI;