The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Copy and paste line caps in stroked paths

These changes was commited to the Birdfont repository Wed, 13 May 2015 11:54:24 +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>
Wed, 13 May 2015 11:54:24 +0000 (13:54 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Wed, 13 May 2015 11:54:24 +0000 (13:54 +0200)
commit 4f5351ae36460c7337495a12bd68de87e8076f31
tree bdd83f9217636318e9cbf634b305f8cef2c01ce1
parent 961e867a5a9379e9326e0d5884d20a57a98d0e3d
Copy and paste line caps in stroked paths

libbirdfont/ClipTool.vala
libbirdfont/StrokeTool.vala
--- a/libbirdfont/ClipTool.vala +++ b/libbirdfont/ClipTool.vala @@ -241,6 +241,12 @@ s.append ("BF stroke: "); s.append (@"$(path.stroke)"); s.append ("\n"); + + if (path.line_cap == LineCap.ROUND) { + s.append ("BF cap: round\n"); + } else if (path.line_cap == LineCap.SQUARE) { + s.append ("BF cap: square\n"); + } } } else if (glyph.path_list.size > 0) { foreach (Path path in glyph.active_paths) { @@ -251,6 +257,12 @@ s.append ("BF stroke: "); s.append (@"$(path.stroke)"); s.append ("\n"); + + if (path.line_cap == LineCap.ROUND) { + s.append ("BF cap: round\n"); + } else if (path.line_cap == LineCap.SQUARE) { + s.append ("BF cap: square\n"); + } } } else { new_path = new Path (); @@ -294,6 +306,12 @@ s.append ("BF stroke: "); s.append (@"$(path.stroke)"); s.append ("\n"); + + if (path.line_cap == LineCap.ROUND) { + s.append ("BF cap: round\n"); + } else if (path.line_cap == LineCap.SQUARE) { + s.append ("BF cap: square\n"); + } } } } @@ -368,6 +386,16 @@ if (p.has_prefix ("stroke:")) { path.stroke = double.parse (p.replace ("stroke: ", "")); + } + + if (p.has_prefix ("cap:")) { + string cap = p.replace ("cap: ", ""); + + if (cap == "round") { + path.line_cap = LineCap.ROUND; + } else if (cap == "square") { + path.line_cap = LineCap.SQUARE; + } } } @@ -377,6 +405,7 @@ glyph = glyphs.get (0).get_current (); foreach (Path p in glyph.path_list) { + PenTool.clear_directions (); destination.add_path (p); destination.add_active_path (p); } @@ -403,6 +432,7 @@ BirdFontFile.parse_path_data (data, path); if (path.points.size > 0) { + PenTool.clear_directions (); glyph.add_path (path); glyph.active_paths.add (path); path.update_region_boundaries ();
--- a/libbirdfont/StrokeTool.vala +++ b/libbirdfont/StrokeTool.vala @@ -274,8 +274,10 @@ foreach (Path p in pl.paths) { if (p.points.size > 22) { r.add (p); - } else { - has_new_corner (p); + } else if (!has_new_corner (p)) { + r.add (p); + } else if (counters (pl, p) == 0) { + r.add (p); } }