The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Copy style attributes

These changes was commited to the Birdfont repository Wed, 08 Jun 2016 12:26:18 +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, 08 Jun 2016 12:26:18 +0000 (14:26 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Wed, 08 Jun 2016 12:26:18 +0000 (14:26 +0200)
commit d85d7a8cc7762ee782010a52ebfce6426a917f73
tree 896bb2363ee87a3abf67b797aa3ae45ea50c636e
parent f2f2927f7d7c42304b4fd98d985edfa0e9f3c7bc
Copy style attributes

libbirdfont/EmbeddedSvg.vala
libbirdfont/Glyph.vala
libsvgbird/Layer.vala
libsvgbird/SvgStyle.vala
--- a/libbirdfont/EmbeddedSvg.vala +++ b/libbirdfont/EmbeddedSvg.vala @@ -105,11 +105,10 @@ public override SvgBird.Object copy () { EmbeddedSvg svg = new EmbeddedSvg ((SvgDrawing) drawing.copy ()); - + SvgBird.Object.copy_attributes (this, svg); svg.svg_data = svg_data; svg.x = x; svg.y = y; - return svg; }
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -1826,6 +1826,8 @@ if (clear_redo) { redo_list.clear (); } + + // set_glyph_data (g); // FIXME: DELETE } public void print_layers (Layer layer, int indent = 0) {
--- a/libsvgbird/Layer.vala +++ b/libsvgbird/Layer.vala @@ -111,10 +111,6 @@ Layer layer = new Layer (); copy_layer (this, layer); Object.copy_attributes (this, layer); - - stdout.printf (@"Copy $(layer.name)\n"); - layer.objects.print_objects (); - return layer; }
--- a/libsvgbird/SvgStyle.vala +++ b/libsvgbird/SvgStyle.vala @@ -99,9 +99,31 @@ } public SvgStyle copy () { - SvgStyle style = new SvgStyle (); - style.apply (this); - return style; + SvgStyle style_copy = new SvgStyle (); + + foreach (string key in style.keys) { + style_copy.style.set (key, style.get (key)); + } + + if (stroke != null) { + style_copy.stroke = ((!) stroke).copy (); + } + + if (fill != null) { + style_copy.fill = ((!) fill).copy (); + } + + if (stroke_gradient != null) { + style_copy.stroke_gradient = ((!) stroke_gradient).copy (); + } + + if (fill_gradient != null) { + style_copy.fill_gradient = ((!) fill_gradient).copy (); + } + + style_copy.stroke_width = stroke_width; + + return style_copy; } public LineCap get_line_cap () {