Commit 2696b26
Font specific line cap settings
Changed files (7)
modifiedlibbirdfont/BezierTool.valamodifiedlibbirdfont/CircleTool.valamodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/MenuTab.valamodifiedlibbirdfont/PenTool.valamodifiedlibbirdfont/RectangleTool.valamodifiedlibbirdfont/StrokeTool.vala
Diff
@@ -146,6 +146,7 @@ public class BezierTool : Tool { if (StrokeTool.add_stroke) { current_path.stroke = StrokeTool.stroke_width;+ current_path.line_cap = StrokeTool.line_cap; } GlyphCanvas.redraw ();@@ -146,6 +146,7 @@ public class CircleTool : Tool { if (StrokeTool.add_stroke) { path.stroke = StrokeTool.stroke_width;+ path.line_cap = StrokeTool.line_cap; } for (int i = 0; i < 3; i++) {@@ -786,6 +786,7 @@ public class DrawingTools : ToolCollection { 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) {@@ -864,6 +865,10 @@ public class DrawingTools : ToolCollection { p.reset_stroke (); } + StrokeTool.line_cap = LineCap.BUTT;+ Font f = BirdFont.get_current_font ();+ f.settings.set_setting ("line_cap", @"butt");+ GlyphCanvas.redraw (); }); stroke_expander.add_tool (line_cap_butt); @@ -880,6 +885,11 @@ public class DrawingTools : ToolCollection { p.reset_stroke (); } + StrokeTool.line_cap = LineCap.ROUND;++ Font f = BirdFont.get_current_font ();+ f.settings.set_setting ("line_cap", @"round");+ GlyphCanvas.redraw (); }); stroke_expander.add_tool (line_cap_round); @@ -896,6 +906,11 @@ public class DrawingTools : ToolCollection { p.reset_stroke (); } + StrokeTool.line_cap = LineCap.SQUARE;++ Font f = BirdFont.get_current_font ();+ f.settings.set_setting ("line_cap", @"square");+ GlyphCanvas.redraw (); }); stroke_expander.add_tool (line_cap_square); @@ -216,6 +216,16 @@ public class MenuTab : FontDisplay { 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@@ -1767,6 +1767,8 @@ public class PenTool : Tool { 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;@@ -72,6 +72,7 @@ public class RectangleTool : Tool { if (StrokeTool.add_stroke) { rectangle.stroke = StrokeTool.stroke_width;+ rectangle.line_cap = StrokeTool.line_cap; } rectangle.init_point_type ();@@ -31,6 +31,8 @@ public class StrokeTool : Tool { public static bool show_stroke_tools = false; public static bool convert_stroke = false; + public static LineCap line_cap = LineCap.BUTT;+ public StrokeTool (string tooltip) { }