The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Don't try to merge single points

These changes was commited to the Birdfont repository Sat, 03 Oct 2015 13:58:38 +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>
Sat, 03 Oct 2015 13:58:38 +0000 (15:58 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 03 Oct 2015 13:58:38 +0000 (15:58 +0200)
commit 81360bb2563245965b728b723876b17c1dec0283
tree 92241b2e7cc17f22ab1bccbb3715f4f08b4dcd34
parent 514d8c96a8249fd99a638a344e4396fedec23362
Don't try to merge single points

libbirdfont/StrokeTool.vala
--- a/libbirdfont/StrokeTool.vala +++ b/libbirdfont/StrokeTool.vala @@ -2069,7 +2069,25 @@ return r; } - + + static void remove_single_points (PathList pl) { + PathList r = new PathList (); + + foreach (Path p in pl.paths) { + p.update_region_boundaries (); + if (p.points.size < 10 + || p.xmax - p.xmin < 0.01 + || p.ymax - p.ymin < 0.01) { + + r.add (p); + } + } + + foreach (Path p in r.paths) { + pl.remove (p); + } + } + public static PathList merge (PathList pl) { bool error = false; PathList m; @@ -2077,6 +2095,7 @@ Path p1, p2; r = get_all_parts (r); + remove_single_points (r); while (paths_has_intersection (r, out p1, out p2)) { if (merge_path (p1, p2, out m, out error)) { @@ -2089,6 +2108,7 @@ } r = get_all_parts (r); + remove_single_points (r); } else { warning ("Not merged."); error = true;