The Birdfont Source Code
Copy and paste strokes
These changes was commited to the Birdfont repository Sun, 03 May 2015 19:05:52 +0000.
Contributing
Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
Copy and paste strokes
--- a/libbirdfont/ClipTool.vala
+++ b/libbirdfont/ClipTool.vala
@@ -236,12 +236,20 @@
foreach (Path path in glyph.path_list) {
s.append ("BF path: ");
s.append (BirdFontFile.get_point_data (path));
+ s.append ("\n");
+
+ s.append ("BF stroke: ");
+ s.append (@"$(path.stroke)");
s.append ("\n");
}
} else if (glyph.path_list.size > 0) {
foreach (Path path in glyph.active_paths) {
s.append ("BF path: ");
s.append (BirdFontFile.get_point_data (path));
+ s.append ("\n");
+
+ s.append ("BF stroke: ");
+ s.append (@"$(path.stroke)");
s.append ("\n");
}
} else {
@@ -281,6 +289,10 @@
if (path.points.size > 0) {
s.append ("BF path: ");
s.append (BirdFontFile.get_point_data (path));
+ s.append ("\n");
+
+ s.append ("BF stroke: ");
+ s.append (@"$(path.stroke)");
s.append ("\n");
}
}
@@ -309,6 +321,7 @@
Glyph destination;
GlyphCollection glyph_collection = new GlyphCollection ('\0', "");
OverView o;
+ Path path = new Path ();
foreach (string p in items) {
if (p.has_prefix ("glyph:")) {
@@ -338,7 +351,7 @@
if (p.has_prefix ("path:")) {
p = p.replace ("path: ", "");
p = p.replace ("\n", "");
- import_birdfont_path (glyph, p);
+ path = import_birdfont_path (glyph, p);
}
if (p.has_prefix ("left:")) {
@@ -351,6 +364,10 @@
glyph.right_limit = double.parse (p.replace ("right: ", ""));
glyph.remove_lines ();
glyph.add_help_lines ();
+ }
+
+ if (p.has_prefix ("stroke:")) {
+ path.stroke = double.parse (p.replace ("stroke: ", ""));
}
}
@@ -380,7 +397,7 @@
}
}
- static void import_birdfont_path (Glyph glyph, string data) {
+ static Path import_birdfont_path (Glyph glyph, string data) {
Path path = new Path ();
BirdFontFile.parse_path_data (data, path);
@@ -402,6 +419,7 @@
}
PenTool.update_selection ();
+ return path;
}
static void paste_letters_to_kerning_tab () {
--- a/libbirdfont/ForesightTool.vala
+++ b/libbirdfont/ForesightTool.vala
@@ -204,7 +204,7 @@
last_move_y = y;
a = get_active_path ();
- if (a.is_open ()) {
+ if (a.is_open () && a.points.size > 1) {
a.get_first_point ().set_reflective_handles (false);
a.get_first_point ().set_tie_handle (false);
}