The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Merge branch 'master' of https://github.com/johanmattssonm/birdfont into HEAD

These changes was commited to the Birdfont repository Sat, 21 Mar 2015 13:51:14 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Sat, 21 Mar 2015 13:51:14 +0000]

Updated Files

AUTHORS
NEWS
install.py
libbirdfont/BirdFontFile.vala
libbirdfont/DefaultCharactersSet.vala
libbirdfont/DrawingTools.vala
libbirdfont/EditPoint.vala
libbirdfont/Font.vala
libbirdfont/ForesightTool.vala
libbirdfont/Glyph.vala
libbirdfont/LoadCallback.vala
libbirdfont/PenTool.vala
libbirdfont/SpacingData.vala
libbirdfont/Tool.vala
libbirdfont/TrackTool.vala
libbirdfont/VersionList.vala
scripts/mac_build.py
scripts/version.py
diff --git a/AUTHORS b/AUTHORS
--- a/AUTHORS +++ b/AUTHORS @@ -6,4 +6,5 @@ Clemens Lang Hideki Yamane Rene Mensen + Marko Jovanovac
diff --git a/NEWS b/NEWS
--- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ + birdfont (2.3.1) stable; + + * Bug fixes + + -- Johan Mattsson <johan.mattsson.m@gmail.com> Fri Mar 20 18:23:31 CET 2015 + birdfont (2.3.0) stable; * Customizable color themes and better icons
--- a/install.py +++ b/install.py @@ -50,21 +50,21 @@ if not os.path.exists ("build/configured"): print ("Project is not configured") exit (1) - - if not os.path.exists ("build/installed"): - print ("Project is not built") - exit (1) parser = OptionParser() parser.add_option ("-d", "--dest", dest="dest", help="install to this directory", metavar="DEST") parser.add_option ("-m", "--nogzip", dest="nogzip", help="don't gzip manpages", default=False) parser.add_option ("-n", "--manpages-directory", dest="mandir", help="put man pages in this directory under prefix") parser.add_option ("-l", "--libdir", dest="libdir", help="path to directory for shared libraries (lib or lib64).") + parser.add_option ("-c", "--skip-command-line-tools", dest="nocli", help="don't install command line tools") (options, args) = parser.parse_args() if not options.dest: options.dest = "" + + if not options.nocli: + options.nocli = False nogzip = options.nogzip @@ -99,9 +99,10 @@ if os.path.isfile ('build/bin/birdfont'): install ('build/bin/birdfont', '/bin', 755) - install ('build/bin/birdfont-autotrace', '/bin', 755) - install ('build/bin/birdfont-export', '/bin', 755) - install ('build/bin/birdfont-import', '/bin', 755) + if not options.nocli: + install ('build/bin/birdfont-autotrace', '/bin', 755) + install ('build/bin/birdfont-export', '/bin', 755) + install ('build/bin/birdfont-import', '/bin', 755) #library if not options.libdir: @@ -136,7 +137,6 @@ else: print ("Can't find libbirdfont.") exit (1) - if os.path.isfile ('build/bin/libbirdxml.so.' + version.LIBBIRDXML_SO_VERSION): install ('build/bin/libbirdxml.so.' + version.LIBBIRDXML_SO_VERSION, libdir, 644) @@ -155,16 +155,21 @@ #manpages + if not nogzip: install ('build/birdfont.1.gz', mandir, 644) - install ('build/birdfont-autotrace.1.gz', mandir, 644) - install ('build/birdfont-export.1.gz', mandir, 644) - install ('build/birdfont-import.1.gz', mandir, 644) + + if not options.nocli: + install ('build/birdfont-autotrace.1.gz', mandir, 644) + install ('build/birdfont-export.1.gz', mandir, 644) + install ('build/birdfont-import.1.gz', mandir, 644) else: install ('resources/linux/birdfont.1', mandir, 644) - install ('resources/linux/birdfont-autotrace.1', mandir, 644) - install ('resources/linux/birdfont-export.1', mandir, 644) - install ('resources/linux/birdfont-import.1', mandir, 644) + + if not options.nocli: + install ('resources/linux/birdfont-autotrace.1', mandir, 644) + install ('resources/linux/birdfont-export.1', mandir, 644) + install ('resources/linux/birdfont-import.1', mandir, 644) #translations for lang_dir in glob.glob('build/locale/*'):
--- a/libbirdfont/BirdFontFile.vala +++ b/libbirdfont/BirdFontFile.vala @@ -261,7 +261,7 @@ os.put_string (Font.to_hex (sc.next.get_char ())); os.put_string ("\" "); - os.put_string (" />\n"); + os.put_string ("/>\n"); } }
--- a/libbirdfont/DefaultCharactersSet.vala +++ b/libbirdfont/DefaultCharactersSet.vala @@ -33,6 +33,7 @@ add_language (t_("Latin"), "la", ""); add_language (t_("Russian"), "ro", "А Б В Г Д Е Ё Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я"); add_language (t_("Swedish"), "sv", "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Ä Ö a b c d e f g h i j k l m n o p q r s t u v w x y z å ä ö"); + add_language (t_("Thai"), "th", "ก-ฺ ฿-๛"); } /** Add a new language to the menu for default character set. @@ -109,9 +110,7 @@ all_characters = get_characters_for_prefered_language (); if (all_characters != "") { - foreach (string c in all_characters.split (" ")) { - gr.add_single (c.get_char ()); - } + gr.parse_ranges (all_characters); } else { /// All lower case letters in alphabetic order separated by space. Letters with diacritical marks should be included. lower_case = t_("a b c d e f g h i j k l m n o p q r s t u v w x y z"); @@ -119,13 +118,8 @@ /// All upper case letters in alphabetic order separated by space. Letters with diacritical marks should be included. upper_case = t_("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"); - foreach (string c in lower_case.split (" ")) { - gr.add_single (c.get_char ()); - } - - foreach (string c in upper_case.split (" ")) { - gr.add_single (c.get_char ()); - } + gr.parse_ranges (lower_case); + gr.parse_ranges (upper_case); } gr.add_range ('0', '9');
--- a/libbirdfont/DrawingTools.vala +++ b/libbirdfont/DrawingTools.vala @@ -1113,7 +1113,7 @@ } void show_point_tool_modifiers () { - draw_tool_modifiers.set_headline (t_("Control Point Tools")); + draw_tool_modifiers.set_headline (t_("Control Points")); tie_handles.set_tool_visibility (true); reflect_handle.set_tool_visibility (true);
--- a/libbirdfont/EditPoint.vala +++ b/libbirdfont/EditPoint.vala @@ -205,6 +205,11 @@ if (next == null || get_next ().next != null) { return; + } + + if (unlikely (reflective_point || tie_handles)) { + warning ("Points on lines can't have tied handles."); + return; } px = get_next ().get_next ().x;
--- a/libbirdfont/Font.vala +++ b/libbirdfont/Font.vala @@ -703,7 +703,7 @@ glyph_name.remove_all (); ligature.remove_all (); - if (path.has_suffix (".svg")) { + if (path.has_suffix (".svg") || path.has_suffix (".SVG")) { Toolbox.select_tool_by_name ("cubic_points"); loaded = parse_svg_file (path); @@ -719,17 +719,17 @@ format = FontFormat.FFI; } - if (path.has_suffix (".bf")) { + if (path.has_suffix (".bf") || path.has_suffix (".BF")) { loaded = parse_bf_file (path); format = FontFormat.BIRDFONT; } - if (path.has_suffix (".bfp")) { + if (path.has_suffix (".bfp") || path.has_suffix (".BFP")) { loaded = parse_bfp_file (path); format = FontFormat.BIRDFONT_PART; } - if (path.has_suffix (".ttf")) { + if (path.has_suffix (".ttf") || path.has_suffix (".TTF")) { loaded = parse_freetype_file (path); if (!loaded) { @@ -751,7 +751,7 @@ font_file = null; // make sure BirdFont asks where to save the file } - if (path.has_suffix (".otf")) { + if (path.has_suffix (".otf") || path.has_suffix (".OTF")) { loaded = parse_freetype_file (path); if (!loaded) {
--- a/libbirdfont/ForesightTool.vala +++ b/libbirdfont/ForesightTool.vala @@ -65,6 +65,8 @@ PointSelection ps; EditPoint first_point; bool clockwise; + + MainWindow.get_current_glyph ().store_undo_state (); last_move_x = x; last_move_y = y; @@ -195,7 +197,12 @@ return; } last = PenTool.selected_points.get (PenTool.selected_points.size - 1); - last.point.convert_to_curve (); + + if (last.point.get_right_handle ().is_line () || last.point.get_left_handle ().is_line ()) { + last.point.convert_to_curve (); + last.point.get_right_handle ().length = 0.01; + last.point.get_left_handle ().length = 0.01; + } } PenTool.move_selected_handle = true; @@ -214,10 +221,20 @@ h = (lh) ? last.point.get_left_handle () : last.point.get_right_handle (); PenTool.selected_handle = h; PenTool.active_handle = h; + + if (previous_point == 0 + && !last.point.reflective_point + && !last.point.tie_handles) { + + last.point.convert_to_curve (); + last.point.set_reflective_handles (true); + last.point.get_right_handle ().length = 0.01; + last.point.get_left_handle ().length = 0.01; + } if (previous_point == 0) { last.point.set_reflective_handles (true); - } + } if (previous_point > 0) { PenTool.retain_angle = last.point.tie_handles; @@ -342,7 +359,35 @@ return last; } + + // FIXME: solve the straight line issue in undo + public override void before_undo () { + EditPoint last; + + if (PenTool.active_path.points.size > 1) { + last = PenTool.active_path.points.get (PenTool.active_path.points.size - 2); + last.convert_to_curve (); + + print (@"Before $(last.x) $(last.y)\n"); + } + } + + public override void after_undo () { + PenTool.selected_points.clear (); + PenTool.active_edit_point = null; + state = NONE; + + EditPoint last; + + if (PenTool.active_path.points.size > 0) { + last = PenTool.active_path.points.get (PenTool.active_path.points.size - 1); + last.convert_to_curve (); + + print (@"After $(last.x) $(last.y)\n"); + } + } + } }
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -1703,10 +1703,14 @@ public override void undo () { Glyph g; + Tool tool; if (undo_list.size == 0) { return; } + + tool = MainWindow.get_toolbox ().get_current_tool (); + tool.before_undo (); g = undo_list.get (undo_list.size - 1); @@ -1718,6 +1722,8 @@ PenTool.update_selected_points (); clear_active_paths (); + + tool.after_undo (); } public override void redo () { @@ -2090,7 +2096,7 @@ glyph = gc.get_current (); glyph.left_limit = left_limit; glyph.right_limit = right_limit; - glyph.add_help_lines (); + // FIXME: DELETE glyph.add_help_lines (); } } }
--- a/libbirdfont/LoadCallback.vala +++ b/libbirdfont/LoadCallback.vala @@ -15,6 +15,8 @@ namespace BirdFont { public class LoadCallback : GLib.Object { + SaveDialogListener dialog; + Font font; public signal void file_loaded (); @@ -22,9 +24,6 @@ } public void load () { - SaveDialogListener dialog; - Font font; - if (MenuTab.suppress_event) { warn_if_test ("Event suppressed"); return;
--- a/libbirdfont/PenTool.vala +++ b/libbirdfont/PenTool.vala @@ -124,10 +124,7 @@ last_point_y = Glyph.path_coordinate_y (y); move_action (this, x, y); - - if (!has_join_icon ()) { - press (b, x, y, false); - } + press (b, x, y, false); if (BirdFont.android) { point_selection_image = true; @@ -1494,7 +1491,9 @@ static void set_default_handle_positions_on_path (Path path) { foreach (EditPoint e in path.points) { - e.recalculate_linear_handles (); + if (!e.tie_handles && !e.reflective_point) { + e.recalculate_linear_handles (); + } } }
--- a/libbirdfont/SpacingData.vala +++ b/libbirdfont/SpacingData.vala @@ -58,19 +58,17 @@ } public void add_connections (string glyph) { - string sb = glyph; - - connections.add (sb); + connections.add (glyph); foreach (SpacingClass s in classes) { if (s.first == glyph) { - if (has_connection (s.next)) { + if (!has_connection (s.next)) { add_connections (s.next); } } if (s.next == glyph) { - if (has_connection (s.first)) { + if (!has_connection (s.first)) { add_connections (s.first); } }
--- a/libbirdfont/Tool.vala +++ b/libbirdfont/Tool.vala @@ -352,7 +352,14 @@ public void set_persistent (bool p) { persistent = p; } + + public virtual void before_undo () { + } + + public virtual void after_undo () { + } + } }
--- a/libbirdfont/TrackTool.vala +++ b/libbirdfont/TrackTool.vala @@ -128,6 +128,11 @@ if (button == 1 && draw_freehand) { add_endpoint_and_merge (x, y); } + + set_tie (); + + PenTool.force_direction (); + BirdFont.get_current_font ().touch (); }); @@ -169,6 +174,21 @@ Tool p = MainWindow.get_toolbox ().get_tool ("pen_tool"); p.key_press_action (p, keyval); }); + } + + void set_tie () { + Glyph glyph = MainWindow.get_current_glyph (); + Path p = glyph.path_list.get (glyph.path_list.size - 1); + + foreach (EditPoint ep in p.points) { + if (ep.get_right_handle ().is_line () || ep.get_left_handle ().is_line ()) { + ep.set_tie_handle (false); + } + + if (!ep.get_right_handle ().is_line () || !ep.get_left_handle ().is_line ()) { + ep.convert_to_curve (); + } + } } public void set_samples_per_point (double s) { @@ -233,6 +253,7 @@ if (DrawingTools.get_selected_point_type () == PointType.QUADRATIC) { foreach (EditPoint e in p.points) { if (e.tie_handles) { + e.convert_to_curve (); e.process_tied_handle (); } } @@ -463,7 +484,9 @@ EditPoint average; Path p; Glyph glyph; - Gee.ArrayList<EditPoint> points = new Gee.ArrayList<EditPoint> (); + Gee.ArrayList<EditPoint> points; + + points = new Gee.ArrayList<EditPoint> (); if (added_points == 0) { warning ("No points to add."); @@ -515,6 +538,7 @@ if (p.points.size > 2) { PenTool.convert_point_to_line (average.get_prev (), true); average.get_prev ().process_tied_handle (); + average.get_prev ().set_tie_handle (false); } }
--- a/libbirdfont/VersionList.vala +++ b/libbirdfont/VersionList.vala @@ -116,7 +116,7 @@ if (unlikely (glyphs.size == 0 && current_version_id == -1)) { warning (@"No glyphs added to collection"); - gl = new Glyph ("", '\0'); + gl = new Glyph.no_lines ("", '\0'); } return (!) gl;
--- a/scripts/mac_build.py +++ b/scripts/mac_build.py @@ -59,8 +59,6 @@ compile_translations() build.libbirdxml(prefix, cc, xml_library_cflags, xml_library_ldflags, valac, valaflags, "libbirdxml." + version.LIBBIRDXML_SO_VERSION + ".dylib", False) build.libbirdfont(prefix, cc, library_cflags, library_ldflags, valac, valaflags, "libbirdfont." + version.SO_VERSION + ".dylib", False) - build.birdfont_autotrace(prefix, cc, cflags, ldflags, valac, valaflags, False) - build.birdfont_export(prefix, cc, cflags, ldflags, valac, valaflags, False) build.birdfont_import(prefix, cc, cflags, ldflags, valac, valaflags, False) if not options.nogtk:
--- a/scripts/version.py +++ b/scripts/version.py @@ -13,7 +13,7 @@ Lesser General Public License for more details. """ - VERSION = '2.3.0' + VERSION = '2.3.1' SO_VERSION_MAJOR = '36' SO_VERSION_MINOR = '0' SO_VERSION = SO_VERSION_MAJOR + '.' + SO_VERSION_MINOR