The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Font specific line cap settings

These changes was commited to the Birdfont repository Tue, 12 May 2015 06:25:47 +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, 12 May 2015 06:25:47 +0000 (08:25 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Tue, 12 May 2015 06:25:47 +0000 (08:25 +0200)
commit 2696b26bc7ceeb2e7026a77fff9d8ca153a9b3c2
tree f4edb1e053287e4b9798d16ad46a2fba1dd0f050
parent 3e6e6999b42c7eced435ff66aceaff412ec45d1d
Font specific line cap settings

libbirdfont/BezierTool.vala
libbirdfont/CircleTool.vala
libbirdfont/DrawingTools.vala
libbirdfont/MenuTab.vala
libbirdfont/PenTool.vala
libbirdfont/RectangleTool.vala
libbirdfont/StrokeTool.vala
--- a/libbirdfont/BezierTool.vala +++ b/libbirdfont/BezierTool.vala @@ -146,6 +146,7 @@ if (StrokeTool.add_stroke) { current_path.stroke = StrokeTool.stroke_width; + current_path.line_cap = StrokeTool.line_cap; } GlyphCanvas.redraw ();
--- a/libbirdfont/CircleTool.vala +++ b/libbirdfont/CircleTool.vala @@ -146,6 +146,7 @@ if (StrokeTool.add_stroke) { path.stroke = StrokeTool.stroke_width; + path.line_cap = StrokeTool.line_cap; } for (int i = 0; i < 3; i++) {
--- a/libbirdfont/DrawingTools.vala +++ b/libbirdfont/DrawingTools.vala @@ -786,6 +786,7 @@ if (StrokeTool.add_stroke) { foreach (Path p in g.active_paths) { p.stroke = StrokeTool.stroke_width; + p.line_cap = StrokeTool.line_cap; } } else { foreach (Path p in g.active_paths) { @@ -863,6 +864,10 @@ p.line_cap = LineCap.BUTT; p.reset_stroke (); } + + StrokeTool.line_cap = LineCap.BUTT; + Font f = BirdFont.get_current_font (); + f.settings.set_setting ("line_cap", @"butt"); GlyphCanvas.redraw (); }); @@ -879,6 +884,11 @@ p.line_cap = LineCap.ROUND; p.reset_stroke (); } + + StrokeTool.line_cap = LineCap.ROUND; + + Font f = BirdFont.get_current_font (); + f.settings.set_setting ("line_cap", @"round"); GlyphCanvas.redraw (); }); @@ -895,6 +905,11 @@ p.line_cap = LineCap.SQUARE; p.reset_stroke (); } + + StrokeTool.line_cap = LineCap.SQUARE; + + Font f = BirdFont.get_current_font (); + f.settings.set_setting ("line_cap", @"square"); GlyphCanvas.redraw (); });
--- a/libbirdfont/MenuTab.vala +++ b/libbirdfont/MenuTab.vala @@ -216,6 +216,16 @@ bool s = bool.parse (stroke); DrawingTools.add_stroke.set_selected (s); StrokeTool.add_stroke = s; + + string lc = f.settings.get_setting ("line_cap"); + + if (lc == "butt") { + StrokeTool.line_cap = LineCap.BUTT; + } else if (lc == "square") { + StrokeTool.line_cap = LineCap.SQUARE; + } else if (lc == "round") { + StrokeTool.line_cap = LineCap.ROUND; + } } // FIXME: background thread
--- a/libbirdfont/PenTool.vala +++ b/libbirdfont/PenTool.vala @@ -1767,6 +1767,8 @@ np = new Path (); g.add_path (np); np.stroke = stroke ? StrokeTool.stroke_width : 0; + np.line_cap = StrokeTool.line_cap; + g.add_active_path (np); active_path = np;
--- a/libbirdfont/RectangleTool.vala +++ b/libbirdfont/RectangleTool.vala @@ -72,6 +72,7 @@ if (StrokeTool.add_stroke) { rectangle.stroke = StrokeTool.stroke_width; + rectangle.line_cap = StrokeTool.line_cap; } rectangle.init_point_type ();
--- a/libbirdfont/StrokeTool.vala +++ b/libbirdfont/StrokeTool.vala @@ -30,6 +30,8 @@ public static bool show_stroke_tools = false; public static bool convert_stroke = false; + + public static LineCap line_cap = LineCap.BUTT; public StrokeTool (string tooltip) { }