Commit bf1ef10
tie handles in svg import
Changed files (1)
Diff
@@ -15,6 +15,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ using Xml;+using Math; namespace BirdFont { @@ -417,10 +418,7 @@ public class ImportSvg { } else { cy = -parse_double (c[++i]); }-/*- px2 = cx;- py2 = cy;- */ + p[pi++] = cx; p[pi++] = cy; @@ -810,6 +808,7 @@ public class ImportSvg { path.points.remove_link (path.points.last ()); } + set_tied_handles (path); glyph.add_path (path); glyph.close_path (); @@ -842,6 +841,22 @@ public class ImportSvg { return double.try_parse ((!) s); }+ + static void set_tied_handles (Path path) {+ double a, b;+ double da, db;+ foreach (EditPoint p in path.points) {+ a = p.get_left_handle ().angle;+ b = p.get_left_handle ().angle;+ + da = a - b;+ db = a - b;+ + if (da < 0.0001 || db < 0.0001) {+ p.set_tie_handle (true);+ }+ }+ } } }