Commit db34855
android port of libbirdfont
Changed files (52)
modifiedbirdfont/Main.valamodifieddodo.pymodifiedlibbirdfont/Argument.valamodifiedlibbirdfont/BackgroundSelection.valamodifiedlibbirdfont/BackgroundTool.valamodifiedlibbirdfont/BirdFont.valamodifiedlibbirdfont/BirdFontFile.valamodifiedlibbirdfont/CharDatabase.valamodifiedlibbirdfont/CircleTool.valamodifiedlibbirdfont/CutBackgroundTool.valamodifiedlibbirdfont/DefaultCharactersSet.valamodifiedlibbirdfont/DescriptionTab.valamodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/ExportTool.valamodifiedlibbirdfont/FileTab.valamodifiedlibbirdfont/Font.valamodifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/GlyphBackgroundImage.valamodifiedlibbirdfont/GlyphCanvas.valamodifiedlibbirdfont/GlyphRange.valamodifiedlibbirdfont/GridTool.valamodifiedlibbirdfont/Icons.valamodifiedlibbirdfont/ImportSvg.valamodifiedlibbirdfont/IntersectionList.valamodifiedlibbirdfont/KerningDisplay.valamodifiedlibbirdfont/KerningList.valamodifiedlibbirdfont/KerningRange.valamodifiedlibbirdfont/KerningTools.valamodifiedlibbirdfont/KeyBindings.valamodifiedlibbirdfont/LanguageSelectionTab.valamodifiedlibbirdfont/MainWindow.valamodifiedlibbirdfont/MenuTab.valamodifiedlibbirdfont/MoveTool.valamodifiedlibbirdfont/OpenFontFormat/Gsub.valamodifiedlibbirdfont/OpenFontFormat/load_font.cmodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/OverWriteDialogListener.valamodifiedlibbirdfont/Path.valamodifiedlibbirdfont/PathList.valamodifiedlibbirdfont/PenTool.valamodifiedlibbirdfont/Preferences.valamodifiedlibbirdfont/Preview.valamodifiedlibbirdfont/RectangleTool.valamodifiedlibbirdfont/ResizeTool.valamodifiedlibbirdfont/SaveDialogListener.valamodifiedlibbirdfont/SpinButton.valamodifiedlibbirdfont/TabBar.valamodifiedlibbirdfont/TestCases.valamodifiedlibbirdfont/Toolbox.valamodifiedlibbirdfont/VersionList.valamodifiedlibbirdfont/ZoomTool.valamodifiedscripts/build.py
Diff
@@ -31,8 +31,8 @@ public static int main (string[] arg) { BirdFont.BirdFont birdfont = new BirdFont.BirdFont (); CharDatabaseParser db = new CharDatabaseParser (); unowned Thread<int> db_thread;- Mutex database_mutex = Mutex ();- Cond main_loop_idle = Cond ();+ Mutex database_mutex = new Mutex ();+ Cond main_loop_idle = new Cond (); bool in_idle = false; birdfont.init (arg, null);@@ -45,7 +45,7 @@ LIBS = [ 'cairo', 'gdk-pixbuf-2.0', 'webkit-1.0',- 'gee-1.0'+ 'gee-0.8' ] def task_build ():@@ -37,6 +37,10 @@ public class Argument : GLib.Object { int i = 0; foreach (string a in args) { + if (a == "") {+ continue;+ }+ // program name if (i == 0) { prev = a;@@ -231,18 +235,18 @@ public class Argument : GLib.Object { public void print_help () requires (args.length () > 0) {- stdout.printf (_("Usage") + ": ");+ stdout.printf (t_("Usage") + ": "); stdout.printf (args.nth (0).data);- stdout.printf (" [" + _("FILE") + "] [" + _("OPTION") + " ...]\n");-- print_padded ("-c, --show-coordinates", _("show coordinate in glyph view"));- print_padded ("-e, --exit", _("exit if a test case fails"));- print_padded ("-f, --fatal-warning", _("treat warnings as fatal"));- print_padded ("-h, --help", _("show this message"));- print_padded ("-m, --mac", _("enable Machintosh customizations"));- print_padded ("-n, --no-translation", _("don't translate"));- print_padded ("-s, --slow", _("sleep between each command in test suite"));- print_padded ("-t --test [TEST]", _("run test case"));+ stdout.printf (" [" + t_("FILE") + "] [" + t_("OPTION") + " ...]\n");++ print_padded ("-c, --show-coordinates", t_("show coordinate in glyph view"));+ print_padded ("-e, --exit", t_("exit if a test case fails"));+ print_padded ("-f, --fatal-warning", t_("treat warnings as fatal"));+ print_padded ("-h, --help", t_("show this message"));+ print_padded ("-m, --mac", t_("enable Machintosh customizations"));+ print_padded ("-n, --no-translation", t_("don't translate"));+ print_padded ("-s, --slow", t_("sleep between each command in test suite"));+ print_padded ("-t --test [TEST]", t_("run test case")); stdout.printf ("\n"); }@@ -38,7 +38,7 @@ class BackgroundSelection : FontDisplay { } public override string get_label () {- return _("Backgrounds");+ return t_("Backgrounds"); } public override string get_name () {@@ -87,6 +87,7 @@ class BackgroundSelection : FontDisplay { } private ImageSurface create_thumbnail (string file) throws GLib.Error {+#if !ANDROID Pixbuf pixbuf; Font font = BirdFont.get_current_font ();@@ -108,6 +109,9 @@ class BackgroundSelection : FontDisplay { } return new ImageSurface.from_png ((!) png_image.get_path ());+#else+ return new ImageSurface (Format.ARGB32, 10, 10); // FIXME: android+#endif } private bool draw_thumbnail (string file, double x, double y, Context cr, int box_index) {@@ -33,7 +33,7 @@ class BackgroundTool : Tool { bool move_bg; public BackgroundTool (string name) {- base (name, _("Move, resize and rotate background image"));+ base (name, t_("Move, resize and rotate background image")); top_limit = 0; bottom_limit = 0;@@ -17,13 +17,13 @@ const string GETTEXT_PACKAGE = "birdfont"; namespace BirdFont { static void print_export_help (string[] arg) {- stdout.printf (_("Usage:"));+ stdout.printf (t_("Usage:")); stdout.printf (arg[0]); stdout.printf (" [OPTION ...] FILE\n");- stdout.printf ("-h, --help " + _("print this message\n"));- stdout.printf ("-o, --output [DIRECTORY] " + _("write files to this directory\n"));- stdout.printf ("-s, --svg " + _("write svg file\n"));- stdout.printf ("-t, --ttf " + _("write ttf and eot files\n"));+ stdout.printf ("-h, --help " + t_("print this message\n"));+ stdout.printf ("-o, --output [DIRECTORY] " + t_("write files to this directory\n"));+ stdout.printf ("-s, --svg " + t_("write svg file\n"));+ stdout.printf ("-t, --ttf " + t_("write ttf and eot files\n")); stdout.printf ("\n"); } @@ -117,7 +117,7 @@ public static int run_export (string[] arg) { directory = File.new_for_path (output_directory); if (!directory.query_exists ()) {- stderr.printf (_("Can't find output directory") + @"$((!)directory.get_path ())\n");+ stderr.printf (t_("Can't find output directory") + @"$((!)directory.get_path ())\n"); return 1; } @@ -192,6 +192,9 @@ public class BirdFont { public static Font current_font; public static Glyph current_glyph; + public BirdFont () { + }+ /** * @param arg command line arguments * @param program path@@ -202,20 +205,33 @@ public class BirdFont { File font_file; string exec_path; +#if ANDROID+ BirdFont.logging = true;+ init_logfile ();++ __android_log_print (ANDROID_LOG_WARN, "BirdFont", @"libbirdfont version $VERSION");+ LogLevelFlags log_levels = LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL | LogLevelFlags.LEVEL_WARNING;+ Log.set_handler (null, log_levels, android_warning);+#else stdout.printf ("birdfont version %s\n", VERSION); stdout.printf ("built on %s\n", BUILD_TIMESTAMP);+#endif + printd ("Args"); args = new Argument.command_line (arg);-+ + printd ("gettext"); if (!args.has_argument ("--no-translation")) { init_gettext (); } + printd ("help"); if (args.has_argument ("--help")) { args.print_help (); Process.exit (0); } + printd ("validate"); err_arg = args.validate (); if (err_arg != 0) { stdout.printf (@"Unknown parameter $(arg [err_arg])\n\n");@@ -223,13 +239,16 @@ public class BirdFont { Process.exit (0); } + printd ("preferences"); Preferences.load (); + printd ("new font"); current_font = new Font (); current_font.set_name (""); current_font.initialised = false; current_glyph = new Glyph ("");-+ + printd ("settings"); experimental = args.has_argument ("--test"); show_coordinates = args.has_argument ("--show-coordinates"); fatal_wanings = args.has_argument ("--fatal-warning");@@ -240,7 +259,8 @@ public class BirdFont { #else mac = args.has_argument ("--mac"); #endif- ++ printd ("path"); if (program_path == null) { exec_path = ""; @@ -269,16 +289,22 @@ public class BirdFont { } } + printd ("fatal"); if (fatal_wanings) { LogLevelFlags levels = LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL | LogLevelFlags.LEVEL_WARNING; Log.set_handler (null, levels, fatal_warning); } + printd ("last file"); Preferences.set_last_file (get_current_font ().get_path ());+ + printd ("default set"); DefaultCharacterSet.create_default_character_sets (); DefaultCharacterSet.get_characters_for_prefered_language (); HeadTable.init ();+ + printd ("Done"); } public static void set_bundle_path (string path) {@@ -286,10 +312,13 @@ public class BirdFont { } static void init_gettext () {+ // FIXME: android this should be OK now+#if !ANDROID string locale_directory = SearchPaths.get_locale_directory (); Intl.setlocale (LocaleCategory.MESSAGES, ""); Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "utf-8"); Intl.bindtextdomain (GETTEXT_PACKAGE, locale_directory);+#endif } public static Font get_current_font () {@@ -306,6 +335,12 @@ public class BirdFont { stderr.printf ("\n%s\n\n", message); assert (!fatal); }++#if ANDROID+ internal static void android_warning (string? log_domain, LogLevelFlags log_levels, string message) {+ __android_log_print (ANDROID_LOG_WARN, "BirdFont", message);+ }+#endif internal static Font new_font () { current_font = new Font ();@@ -334,9 +369,30 @@ public class BirdFont { } internal static File get_settings_directory () {- File home = File.new_for_path (Environment.get_home_dir ());- File settings = home.get_child (".birdfont");+ string home_path;+ File home;+ File settings;++#if ANDROID+ home_path = "/data/data/org.birdfont.sefyr/files";+ home = File.new_for_path (home_path);++ if (!home.query_exists ()) {+ printd ("Create settings directory.");+ DirUtils.create ((!) home.get_path (), 0xFFFFFF);+ }+#else+ home_path = Environment.get_home_dir ();+ + if (is_null (home_path)) {+ warning ("No home directory set.");+ home_path = ".";+ } + home = File.new_for_path (home_path);+#endif+ settings = home.get_child (".birdfont");+ if (!settings.query_exists ()) { DirUtils.create ((!) settings.get_path (), 0xFFFFFF); }@@ -410,6 +466,9 @@ internal static void log_warning (string? log_domain, LogLevelFlags log_levels, /** Write debug output to logfile. */ void printd (string s) {+#if ANDROID+ __android_log_print (ANDROID_LOG_WARN, "BirdFont", s);+#else if (unlikely (BirdFont.logging)) { try { if (BirdFont.logstream != null) {@@ -421,6 +480,17 @@ void printd (string s) { warning (e.message); } }+#endif+}++#if ANDROID+string t_ (string t) {+ return t;+}+#else+string t_ (string t) {+ return _(t); }+#endif }@@ -35,6 +35,8 @@ class BirdFontFile { Xml.Doc* doc; Xml.Node* root; + printd (@"Init xml parser.\n");+ Parser.init (); printd (@"Loading $path\n");@@ -131,7 +131,7 @@ public class CharDatabase { } public static void show_loading_message () {- MainWindow.set_status (_("Loading the unicode character database") + " ...");+ MainWindow.set_status (t_("Loading the unicode character database") + " ..."); } public static void get_full_unicode (GlyphRange glyph_range) {@@ -33,7 +33,7 @@ public class CircleTool : Tool { bool resize_circle = false; public CircleTool (string n) {- base (n, _("Circle"));+ base (n, t_("Circle")); press_action.connect((self, b, x, y) => { press (b, x, y);@@ -31,7 +31,7 @@ class CutBackgroundTool : Tool { public signal void new_image (GlyphBackgroundImage file); public CutBackgroundTool (string name) {- base (name, _("Crop background image"));+ base (name, t_("Crop background image")); select_action.connect((self) => { });@@ -191,6 +191,9 @@ class CutBackgroundTool : Tool { } void save_img (Surface sr, Glyph g) {+#if ANDROID+ return; // FIXME: android+#else GlyphBackgroundImage newbg; Font f = BirdFont.get_current_font (); File img_dir;@@ -237,6 +240,7 @@ class CutBackgroundTool : Tool { newbg.img_y = Glyph.path_coordinate_y (fmin (y1, y2)) + hc + 0.5; new_image (newbg);+#endif } } @@ -22,16 +22,16 @@ public class DefaultCharacterSet { public static void create_default_character_sets () { languages = new DefaultLanguages (); - add_language (_("Default language"), "", "");- add_language (_("Private use area"), "PRIVATE_USE", "");+ add_language (t_("Default language"), "", "");+ add_language (t_("Private use area"), "PRIVATE_USE", ""); - add_language (_("Chinese"), "zh", "");- add_language (_("English"), "en", "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 (_("Greek"), "el", "Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ ς τ υ φ χ ψ ω");- add_language (_("Japanese"), "ja", "");- add_language (_("Javanese"), "jv", "ꦀ ꦁ ꦂ ꦃ ꦄ ꦅ ꦆ ꦇ ꦈ ꦉ ꦊ ꦋ ꦌ ꦍ ꦎ ꦏ ꦐ ꦑ ꦒ ꦓ ꦔ ꦕ ꦖ ꦗ ꦘ ꦙ ꦚ ꦛ ꦜ ꦝ ꦞ ꦟ ꦠ ꦡ ꦢ ꦣ ꦤ ꦥ ꦦ ꦧ ꦨ ꦩ ꦪ ꦫ ꦬ ꦭ ꦮ ꦯ ꦰ ꦱ ꦲ ꦳ ꦴ ꦵ ꦶ ꦷ ꦸ ꦹ ꦺ ꦻ ꦼ ꦽ ꦾ ꦿ ꧀ ꧁ ꧂ ꧃ ꧄ ꧅ ꧆ ꧇ ꧈ ꧉ ꧊ ꧋ ꧌ ꧍ ꧏ ꧐ ꧑ ꧒ ꧓ ꧔ ꧕ ꧖ ꧗ ꧘ ꧙ ꧞ ꧟ 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 (_("Russian"), "ro", "А Б В Г Д Е Ё Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я");- add_language (_("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_("Chinese"), "zh", "");+ add_language (t_("English"), "en", "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_("Greek"), "el", "Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ ς τ υ φ χ ψ ω");+ add_language (t_("Japanese"), "ja", "");+ add_language (t_("Javanese"), "jv", "ꦀ ꦁ ꦂ ꦃ ꦄ ꦅ ꦆ ꦇ ꦈ ꦉ ꦊ ꦋ ꦌ ꦍ ꦎ ꦏ ꦐ ꦑ ꦒ ꦓ ꦔ ꦕ ꦖ ꦗ ꦘ ꦙ ꦚ ꦛ ꦜ ꦝ ꦞ ꦟ ꦠ ꦡ ꦢ ꦣ ꦤ ꦥ ꦦ ꦧ ꦨ ꦩ ꦪ ꦫ ꦬ ꦭ ꦮ ꦯ ꦰ ꦱ ꦲ ꦳ ꦴ ꦵ ꦶ ꦷ ꦸ ꦹ ꦺ ꦻ ꦼ ꦽ ꦾ ꦿ ꧀ ꧁ ꧂ ꧃ ꧄ ꧅ ꧆ ꧇ ꧈ ꧉ ꧊ ꧋ ꧌ ꧍ ꧏ ꧐ ꧑ ꧒ ꧓ ꧔ ꧕ ꧖ ꧗ ꧘ ꧙ ꧞ ꧟ 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_("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 a new language to the menu for default character set.@@ -109,10 +109,10 @@ public class DefaultCharacterSet { } } else { /// All lower case letters in alphabetic order separated by space- lower_case = _("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");+ 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"); /// All upper case letters in alphabetic order separated by space- upper_case = _("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");+ 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 ());@@ -26,7 +26,7 @@ public class DescriptionTab : FontDisplay { } public override string get_label () {- return _("Description");+ return t_("Description"); } } @@ -75,7 +75,7 @@ public class DrawingTools : ToolCollection { draw_tools.add_tool (resize_tool); // quadratic Bézier points- Tool quadratic_points = new Tool ("quadratic_points", _("Create quadratic Bézier curves"));+ Tool quadratic_points = new Tool ("quadratic_points", t_("Create quadratic Bézier curves")); quadratic_points.select_action.connect ((self) => { point_type = PointType.QUADRATIC; Preferences.set ("point_type", "quadratic_points");@@ -83,7 +83,7 @@ public class DrawingTools : ToolCollection { draw_tool_modifiers.add_tool (quadratic_points); // cubic Bézier points- Tool cubic_points = new Tool ("cubic_points", _("Create cubic Bézier curves"));+ Tool cubic_points = new Tool ("cubic_points", t_("Create cubic Bézier curves")); cubic_points.select_action.connect ((self) => { point_type = PointType.CUBIC; Preferences.set ("point_type", "cubic_points");@@ -91,7 +91,7 @@ public class DrawingTools : ToolCollection { draw_tool_modifiers.add_tool (cubic_points); // two quadratic points off curve points for each quadratic control point- Tool double_points = new Tool ("double_points", _("Quadratic path with two line handles"));+ Tool double_points = new Tool ("double_points", t_("Quadratic path with two line handles")); double_points.select_action.connect ((self) => { point_type = PointType.DOUBLE_CURVE; Preferences.set ("point_type", "double_points");@@ -99,7 +99,7 @@ public class DrawingTools : ToolCollection { draw_tool_modifiers.add_tool (double_points); // convert point- Tool convert_points = new Tool ("convert_point", _("Convert selected points"));+ Tool convert_points = new Tool ("convert_point", t_("Convert selected points")); convert_points.select_action.connect ((self) => { PenTool.convert_point_types (); MainWindow.get_current_glyph ().update_view ();@@ -108,7 +108,7 @@ public class DrawingTools : ToolCollection { draw_tool_modifiers.add_tool (convert_points); // tie edit point handles- Tool tie_handles = new Tool ("tie_point", _("Tie curve handles for the selected edit point"), 'w');+ Tool tie_handles = new Tool ("tie_point", t_("Tie curve handles for the selected edit point"), 'w'); tie_handles.select_action.connect ((self) => { bool tie; EditPoint p;@@ -144,7 +144,7 @@ public class DrawingTools : ToolCollection { edit_point_modifiers.add_tool (tie_handles); // symmetrical handles- Tool reflect_handle = new Tool ("symmetric", _("Symmetrical handles"), 'r');+ Tool reflect_handle = new Tool ("symmetric", t_("Symmetrical handles"), 'r'); reflect_handle.select_action.connect ((self) => { bool symmetrical; PointSelection ep;@@ -166,7 +166,7 @@ public class DrawingTools : ToolCollection { }); edit_point_modifiers.add_tool (reflect_handle); - Tool create_line = new Tool ("create_line", _("Convert segment to line."), 'r');+ Tool create_line = new Tool ("create_line", t_("Convert segment to line."), 'r'); create_line.select_action.connect ((self) => { PenTool.convert_segment_to_line (); MainWindow.get_current_glyph ().update_view ();@@ -174,14 +174,14 @@ public class DrawingTools : ToolCollection { edit_point_modifiers.add_tool (create_line); // path tools- Tool union_paths_tool = new Tool ("union_paths", _("Merge paths"));+ Tool union_paths_tool = new Tool ("union_paths", t_("Merge paths")); union_paths_tool.select_action.connect ((self) => { Glyph g = MainWindow.get_current_glyph (); g.merge_all (); }); path_tool_modifiers.add_tool (union_paths_tool); - Tool reverse_path_tool = new Tool ("reverse_path", _("Create counter from outline"));+ Tool reverse_path_tool = new Tool ("reverse_path", t_("Create counter from outline")); reverse_path_tool.select_action.connect ((self) => { Glyph g = MainWindow.get_current_glyph (); @@ -193,7 +193,7 @@ public class DrawingTools : ToolCollection { }); path_tool_modifiers.add_tool (reverse_path_tool); - Tool move_layer = new Tool ("move_layer", _("Move to path to the bottom layer"), 'd');+ Tool move_layer = new Tool ("move_layer", t_("Move to path to the bottom layer"), 'd'); move_layer.select_action.connect ((self) => { Glyph g = MainWindow.get_current_glyph (); @@ -204,14 +204,14 @@ public class DrawingTools : ToolCollection { }); path_tool_modifiers.add_tool (move_layer); - Tool flip_vertical = new Tool ("flip_vertical", _("Flip path vertically"));+ Tool flip_vertical = new Tool ("flip_vertical", t_("Flip path vertically")); flip_vertical.select_action.connect ((self) => { MoveTool.flip_vertical (); MainWindow.get_current_glyph ().update_view (); }); path_tool_modifiers.add_tool (flip_vertical); - Tool flip_horizontal = new Tool ("flip_horizontal", _("Flip path horizontally"));+ Tool flip_horizontal = new Tool ("flip_horizontal", t_("Flip path horizontally")); flip_horizontal.select_action.connect ((self) => { MoveTool.flip_horizontal (); MainWindow.get_current_glyph ().update_view ();@@ -219,7 +219,7 @@ public class DrawingTools : ToolCollection { path_tool_modifiers.add_tool (flip_horizontal); // Character set tools- Tool full_unicode = new Tool ("utf_8", _("Show full unicode characters set"), 'f', CTRL);+ Tool full_unicode = new Tool ("utf_8", t_("Show full unicode characters set"), 'f', CTRL); full_unicode.select_action.connect ((self) => { MainWindow.get_tab_bar ().add_unique_tab (new OverView (), 100, false); OverView o = MainWindow.get_overview ();@@ -235,7 +235,7 @@ public class DrawingTools : ToolCollection { }); characterset_tools.add_tool (full_unicode); - Tool custom_character_set = new Tool ("custom_character_set", _("Show default characters set"), 'r', CTRL);+ Tool custom_character_set = new Tool ("custom_character_set", t_("Show default characters set"), 'r', CTRL); custom_character_set.select_action.connect ((self) => { MainWindow.get_tab_bar ().add_unique_tab (new OverView (), 100, false); OverView o = MainWindow.get_overview ();@@ -251,7 +251,7 @@ public class DrawingTools : ToolCollection { }); characterset_tools.add_tool (custom_character_set); - Tool avalilable_characters = new Tool ("available_characters", _("Show all characters in the font"), 'd', CTRL);+ Tool avalilable_characters = new Tool ("available_characters", t_("Show all characters in the font"), 'd', CTRL); avalilable_characters.select_action.connect ((self) => { MainWindow.get_tab_bar ().add_unique_tab (new OverView (), 100, false); OverView o = MainWindow.get_overview ();@@ -265,7 +265,7 @@ public class DrawingTools : ToolCollection { }); characterset_tools.add_tool (avalilable_characters); - Tool delete_glyph = new Tool ("delete_selected_glyph", _("Delete selected glyph"));+ Tool delete_glyph = new Tool ("delete_selected_glyph", t_("Delete selected glyph")); delete_glyph.select_action.connect ((self) => { OverView o = MainWindow.get_overview (); @@ -320,7 +320,7 @@ public class DrawingTools : ToolCollection { } // guide lines, grid and other guidlines- Tool help_lines = new Tool ("help_lines", _("Show guidelines"), 'l');+ Tool help_lines = new Tool ("help_lines", t_("Show guidelines"), 'l'); help_lines.select_action.connect ((self) => { bool h; h = GlyphCanvas.get_current_glyph ().get_show_help_lines ();@@ -331,7 +331,7 @@ public class DrawingTools : ToolCollection { guideline_tools.add_tool (help_lines); - Tool xheight_help_lines = new Tool ("show_xheight_helplines", _("Show guidelines for x-height and baseline"), 'x');+ Tool xheight_help_lines = new Tool ("show_xheight_helplines", t_("Show guidelines for x-height and baseline"), 'x'); xheight_help_lines.select_action.connect ((self) => { Glyph g = MainWindow.get_current_glyph (); bool v = !g.get_xheight_lines_visible ();@@ -346,7 +346,7 @@ public class DrawingTools : ToolCollection { }); guideline_tools.add_tool (xheight_help_lines); - Tool background_help_lines = new Tool ("background_help_lines", _("Show guidelines at top and bottom margin"), 't');+ Tool background_help_lines = new Tool ("background_help_lines", t_("Show guidelines at top and bottom margin"), 't'); background_help_lines.select_action.connect ((self) => { Glyph g = MainWindow.get_current_glyph (); bool v = !g.get_margin_lines_visible ();@@ -364,21 +364,21 @@ public class DrawingTools : ToolCollection { guideline_tools.add_tool (new_grid); // Zoom tools - Tool zoom_in = new Tool ("zoom_in", _("Zoom in"), '+', CTRL);+ Tool zoom_in = new Tool ("zoom_in", t_("Zoom in"), '+', CTRL); zoom_in.select_action.connect ((self) => { zoom_tool.store_current_view (); glyph_canvas.get_current_display ().zoom_in (); }); view_tools.add_tool (zoom_in); - Tool zoom_out = new Tool ("zoom_out", _("Zoom out"), '-', CTRL);+ Tool zoom_out = new Tool ("zoom_out", t_("Zoom out"), '-', CTRL); zoom_out.select_action.connect ((self) => { zoom_tool.store_current_view (); glyph_canvas.get_current_display ().zoom_out (); }); view_tools.add_tool (zoom_out); - Tool reset_zoom = new Tool ("zoom_1_1", _("Zoom to scale 1:1"), '0', CTRL);+ Tool reset_zoom = new Tool ("zoom_1_1", t_("Zoom to scale 1:1"), '0', CTRL); reset_zoom.select_action.connect ((self) => { zoom_tool.store_current_view (); glyph_canvas.get_current_display ().reset_zoom ();@@ -386,21 +386,21 @@ public class DrawingTools : ToolCollection { }); view_tools.add_tool (reset_zoom); - Tool full_glyph = new Tool ("full_glyph", _("Show full glyph"));+ Tool full_glyph = new Tool ("full_glyph", t_("Show full glyph")); full_glyph.select_action.connect((self) => { zoom_tool.store_current_view (); zoom_tool.zoom_full_glyph (); }); view_tools.add_tool (full_glyph); - Tool zoom_boundries = new Tool ("zoom_boundries", _("Zoom in at region boundries"), 'v');+ Tool zoom_boundries = new Tool ("zoom_boundries", t_("Zoom in at region boundries"), 'v'); zoom_boundries.select_action.connect((self) => { zoom_tool.store_current_view (); glyph_canvas.get_current_display ().zoom_max (); }); view_tools.add_tool (zoom_boundries); - Tool zoom_bg = new Tool ("zoom_background_image", _("Zoom in background image"));+ Tool zoom_bg = new Tool ("zoom_background_image", t_("Zoom in background image")); zoom_bg.select_action.connect((self) => { if (MainWindow.get_current_glyph ().get_background_image () != null) { zoom_tool.store_current_view (); @@ -413,13 +413,13 @@ public class DrawingTools : ToolCollection { }); view_tools.add_tool (zoom_bg); - Tool zoom_prev = new Tool ("prev", _("Previous view"), 'j', CTRL);+ Tool zoom_prev = new Tool ("prev", t_("Previous view"), 'j', CTRL); zoom_prev.select_action.connect((self) => { zoom_tool.previous_view (); }); view_tools.add_tool (zoom_prev); - Tool zoom_next = new Tool ("next", _("Next view"), 'l', CTRL);+ Tool zoom_next = new Tool ("next", t_("Next view"), 'l', CTRL); zoom_next.select_action.connect((self) => { zoom_tool.next_view (); });@@ -433,7 +433,7 @@ public class DrawingTools : ToolCollection { shape_tools.add_tool (rectangle); // background tools- background_scale = new SpinButton ("scale_background", _("Set size for background image"));+ background_scale = new SpinButton ("scale_background", t_("Set size for background image")); background_scale.set_int_value ("1.000"); background_scale.new_value_action.connect((self) => {@@ -463,7 +463,7 @@ public class DrawingTools : ToolCollection { background_tools.add_tool (cut_background); this.cut_background = cut_background; - Tool show_bg = new Tool ("show_background", _("Show/hide background image"));+ Tool show_bg = new Tool ("show_background", t_("Show/hide background image")); show_bg.select_action.connect ((self) => { Glyph g = MainWindow.get_current_glyph (); g.set_background_visible (!g.get_background_visible ());@@ -471,12 +471,12 @@ public class DrawingTools : ToolCollection { }); background_tools.add_tool (show_bg); - Tool bg_selection = new Tool ("insert_background", _("Insert a new background image"));+ Tool bg_selection = new Tool ("insert_background", t_("Insert a new background image")); bg_selection.select_action.connect((self) => { Glyph? g = null; FontDisplay fd = MainWindow.get_current_display (); TooltipArea tp = MainWindow.get_tool_tip ();- tp.show_text (_("Creating thumbnails"));+ tp.show_text (t_("Creating thumbnails")); Tool.yield (); @@ -495,7 +495,7 @@ public class DrawingTools : ToolCollection { bg_selection.set_show_background (true); background_tools.add_tool (bg_selection); - SpinButton background_contrast = new SpinButton ("background_contrast", _("Set contrast for background image"));+ SpinButton background_contrast = new SpinButton ("background_contrast", t_("Set contrast for background image")); background_contrast.set_value_round (1); background_contrast.new_value_action.connect ((self) => {@@ -514,7 +514,7 @@ public class DrawingTools : ToolCollection { }); // color and style- ColorTool stroke_color = new ColorTool (_("Stroke color"));+ ColorTool stroke_color = new ColorTool (t_("Stroke color")); stroke_color.color_updated.connect (() => { Path.line_color_r = stroke_color.color_r; Path.line_color_g = stroke_color.color_g;@@ -536,7 +536,7 @@ public class DrawingTools : ToolCollection { style_tools.add_tool (stroke_color); SpinButton stroke_width;- stroke_width = new SpinButton ("stroke_width", _("Stroke width"));+ stroke_width = new SpinButton ("stroke_width", t_("Stroke width")); if (Preferences.get ("stroke_width") == "") { stroke_width.set_value_round (1);@@ -556,7 +556,7 @@ public class DrawingTools : ToolCollection { stroke_width.set_max (4); stroke_width.set_min (0.2); - ColorTool handle_color = new ColorTool (_("Handle color"));+ ColorTool handle_color = new ColorTool (t_("Handle color")); handle_color.color_updated.connect (() => { Path.handle_color_r = handle_color.color_r; Path.handle_color_g = handle_color.color_g;@@ -580,7 +580,7 @@ public class DrawingTools : ToolCollection { // adjust precision string precision_value = Preferences.get ("precision"); - precision = new SpinButton ("precision", _("Set precision"));+ precision = new SpinButton ("precision", t_("Set precision")); if (precision_value != "") { precision.set_value (precision_value);@@ -604,7 +604,7 @@ public class DrawingTools : ToolCollection { style_tools.add_tool (precision); - Tool show_all_line_handles = new Tool ("show_all_line_handles", _("Show all control point handles or only handles for the selected points."));+ Tool show_all_line_handles = new Tool ("show_all_line_handles", t_("Show all control point handles or only handles for the selected points.")); show_all_line_handles.select_action.connect((self) => { Path.show_all_line_handles = !Path.show_all_line_handles; Glyph g = MainWindow.get_current_glyph ();@@ -613,7 +613,7 @@ public class DrawingTools : ToolCollection { style_tools.add_tool (show_all_line_handles); // fill color- ColorTool fill_color = new ColorTool (_("Object color"));+ ColorTool fill_color = new ColorTool (t_("Object color")); fill_color.color_updated.connect (() => { Path.fill_color_r = fill_color.color_r; Path.fill_color_g = fill_color.color_g;@@ -634,7 +634,7 @@ public class DrawingTools : ToolCollection { fill_color.set_a (double.parse (Preferences.get ("fill_color_a"))); style_tools.add_tool (fill_color); - Tool fill_open_path = new Tool ("fill_open_path", _("Set fill color for open paths."));+ Tool fill_open_path = new Tool ("fill_open_path", t_("Set fill color for open paths.")); fill_open_path.select_action.connect((self) => { Path.fill_open_path = !Path.fill_open_path; Glyph g = MainWindow.get_current_glyph ();@@ -642,7 +642,7 @@ public class DrawingTools : ToolCollection { }); style_tools.add_tool (fill_open_path); - Tool ttf_units = new Tool ("ttf_units", _("Use TTF units."));+ Tool ttf_units = new Tool ("ttf_units", t_("Use TTF units.")); ttf_units.select_action.connect((self) => { GridTool.ttf_units = !GridTool.ttf_units; Preferences.set ("ttf_units", @"$(GridTool.ttf_units)");@@ -802,7 +802,7 @@ public class DrawingTools : ToolCollection { } public SpinButton add_new_grid () {- SpinButton grid_width = new SpinButton ("grid_width", _("Set size for grid"));+ SpinButton grid_width = new SpinButton ("grid_width", t_("Set size for grid")); Toolbox tb = MainWindow.get_toolbox (); grid_width.new_value_action.connect((self) => {@@ -347,9 +347,9 @@ os.put_string ( </div> <div>- <h4 class="smaller">""" + _("Alphabet") + """</h4>- <p class="smaller">""" + _("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") + """</p>- <p class="smaller">""" + _("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") + """</p>+ <h4 class="smaller">""" + t_("Alphabet") + """</h4>+ <p class="smaller">""" + 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") + """</p>+ <p class="smaller">""" + 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") + """</p> <p class="smaller">0 1 2 3 4 5 6 7 8 9</p> </div> @@ -513,7 +513,7 @@ os.put_string ( string[] spawn_args = get_birdfont_export (folder, temp_file); string c = ""; - MainWindow.set_status (_("Writing TTF and EOT files."));+ MainWindow.set_status (t_("Writing TTF and EOT files.")); foreach (string s in spawn_args) { c += s + " ";@@ -527,7 +527,7 @@ os.put_string ( public static bool export_svg_font () { Font font = BirdFont.get_current_font ();- MainWindow.set_status (_("Writing SVG file."));+ MainWindow.set_status (t_("Writing SVG file.")); return export_svg_font_path (font.get_folder ()); } @@ -173,7 +173,7 @@ public class FileTab : FontDisplay { cr.set_source_rgba (0.3, 0.3, 0.3, 1); cr.set_font_size (18); cr.move_to (50, top - 9);- cr.show_text (_("No fonts created yet."));+ cr.show_text (t_("No fonts created yet.")); cr.restore (); } @@ -182,7 +182,7 @@ public class FileTab : FontDisplay { cr.set_source_rgba (0.3, 0.3, 0.3, 1); cr.set_font_size (18); cr.move_to (50, top - 9);- cr.show_text (_("Recent files"));+ cr.show_text (t_("Recent files")); cr.restore (); } @@ -206,7 +206,7 @@ public class FileTab : FontDisplay { cr.set_source_rgba (0.3, 0.3, 0.3, 1); cr.set_font_size (18); cr.move_to (50, y + 2 * row_height - 9);- cr.show_text (_("Backup"));+ cr.show_text (t_("Backup")); cr.restore (); s += 2; y += 2 * row_height;@@ -272,7 +272,7 @@ public class FileTab : FontDisplay { } public override string get_label () {- return _("Files");+ return t_("Files"); } public override string get_name () {@@ -26,13 +26,13 @@ public enum FontFormat { public class Font : GLib.Object { /** Table with glyphs sorted by their unicode value. */- public GlyphTable glyph_cache = new GlyphTable ();+ public GlyphTable glyph_cache; /** Table with glyphs sorted by their name. */- public GlyphTable glyph_name = new GlyphTable ();+ public GlyphTable glyph_name; /** Table with ligatures. */- public GlyphTable ligature = new GlyphTable ();+ public GlyphTable ligature; public List <string> background_images = new List <string> (); public string background_scale = "1";@@ -60,14 +60,14 @@ public class Font : GLib.Object { bool modified = false; // name table descriptions- public string postscript_name = "Typeface";- public string name = "Typeface";- public string subfamily = "Regular";- public string full_name = "Typeface";- public string unique_identifier = "Typeface";- public string version = "Version 1.0";- public string description = "";- public string copyright = "";+ public string postscript_name;+ public string name;+ public string subfamily;+ public string full_name;+ public string unique_identifier;+ public string version;+ public string description;+ public string copyright; public bool bold = false; public bool italic = false;@@ -78,14 +78,31 @@ public class Font : GLib.Object { OpenFontFormatReader otf; bool otf_font = false; - public List<string> grid_width = new List<string> ();+ public List<string> grid_width; /** File format. */ public FontFormat format = FontFormat.BIRDFONT; - KerningClasses kerning_classes = new KerningClasses ();+ KerningClasses kerning_classes; public Font () {+ postscript_name = "Typeface";+ name = "Typeface";+ subfamily = "Regular";+ full_name = "Typeface";+ unique_identifier = "Typeface";+ version = "Version 1.0";+ description = "";+ copyright = "";+ + glyph_cache = new GlyphTable ();+ glyph_name = new GlyphTable ();+ ligature = new GlyphTable ();+ + grid_width = new List<string> ();+ + kerning_classes = new KerningClasses ();+ // positions in pixels at first zoom level // default x-height should be 60 in 1:1 top_limit = -84 ;@@ -516,7 +533,7 @@ public class Font : GLib.Object { } modified = false;- add_thumbnail ();+ Preferences.add_recent_files (get_path ()); return file_written;@@ -614,7 +631,6 @@ public class Font : GLib.Object { }*/ if (recent) {- add_thumbnail (); Preferences.add_recent_files (get_path ()); } @@ -663,49 +679,6 @@ public class Font : GLib.Object { return true; } - private void add_thumbnail () {- File f = BirdFont.get_thumbnail_directory ().get_child (@"$((!) get_file_name ()).png");- Glyph? gl = get_glyph ("a");- Glyph g;- ImageSurface img;- ImageSurface img_scale;- Context cr;- double scale;- - if (gl == null) {- gl = get_glyph_indice (4);- } - - if (gl == null) {- gl = get_not_def_character ();- }- - g = (!) gl;-- img = g.get_thumbnail ();- scale = 70.0 / img.get_width ();- - if (scale > 70.0 / img.get_height ()) {- scale = 70.0 / img.get_height ();- }- - if (scale > 1) {- scale = 1;- }-- img_scale = new ImageSurface (Format.ARGB32, (int) (scale * img.get_width ()), (int) (scale * img.get_height ()));- cr = new Context (img_scale);- - cr.scale (scale, scale);-- cr.save ();- cr.set_source_surface (img, 0, 0);- cr.paint ();- cr.restore ();- - img_scale.write_to_png ((!) f.get_path ());- }- /** Callback function for loading glyph in a separate thread. */ public void add_glyph_callback (Glyph g) { GlyphCollection? gcl;@@ -328,7 +328,7 @@ public class Glyph : FontDisplay { public override void selected_canvas () { add_help_lines ();- KeyBindings.singleton.set_require_modifier (false);+ KeyBindings.set_require_modifier (false); glyph_sequence = Preferences.get ("glyph_sequence"); MainWindow.native_window.set_scrollbar_size (0); }@@ -110,8 +110,10 @@ public class GlyphBackgroundImage { } if (background_image == null) {+#if !ANDROID // FIXME background_image = new ImageSurface.from_png (path); original_image = new ImageSurface.from_png (path);+#endif } return (!) background_image;@@ -205,6 +207,7 @@ public class GlyphBackgroundImage { } private void create_png () {+#if !ANDROID string fn = @"$path.png"; Font font = BirdFont.get_current_font ();@@ -226,6 +229,9 @@ public class GlyphBackgroundImage { } catch (GLib.Error e) { warning (e.message); }+#endif++ // FIXME: android } public void set_img_rotation_from_coordinate (double x, double y) {@@ -24,9 +24,10 @@ public class GlyphCanvas : GLib.Object { public FontDisplay current_display; public signal void signal_redraw_area (int x, int y, int w, int h); - public static WidgetAllocation allocation = new WidgetAllocation (); + public static WidgetAllocation allocation; public GlyphCanvas () { + allocation = new WidgetAllocation (); } public static WidgetAllocation get_allocation () {@@ -18,13 +18,14 @@ public class GlyphRange { List<UniRange> ranges; - public unowned List<string> unassigned = new List<string> ();+ public List<string> unassigned; uint32 len = 0; bool range_is_class = false; public GlyphRange () {+ unassigned = new List<string> (); } public bool is_class () {@@ -32,7 +32,7 @@ class GridTool : Tool { public GridTool (string n) { string units;- base (n, _("Show grid"), 'g', NONE);+ base (n, t_("Show grid"), 'g', NONE); units = Preferences.get ("ttf_units"); if (units == "true") {@@ -19,6 +19,9 @@ using Cairo; public class Icons { public static ImageSurface? get_icon (string? name) {+#if ANDROID // FIXME:+ return null;+#else ImageSurface? img = null; File f; @@ -37,6 +40,7 @@ public class Icons { img = new ImageSurface.from_png ((!)f.get_path ()); return img;+#endif } public static File find_icon (string name) {@@ -24,7 +24,7 @@ public class ImportSvg { string? p; string path; - p = MainWindow.file_chooser_open (_("Import"));+ p = MainWindow.file_chooser_open (t_("Import")); if (p == null) { return;@@ -17,13 +17,15 @@ using Math; namespace BirdFont { class IntersectionList {- public List<Intersection> points = new List<Intersection> ();+ public List<Intersection> points; public void add (Intersection i) { double d; Intersection l; bool close = false;- + + points = new List<Intersection> ();+ if (points.length () == 0) { points.append (i); return;@@ -40,7 +40,7 @@ public class KerningDisplay : FontDisplay { } public override string get_label () {- return _("Kerning");+ return t_("Kerning"); } public override string get_name () {@@ -60,9 +60,9 @@ public class KerningDisplay : FontDisplay { } public void draw_error_message (WidgetAllocation allocation, Context cr) {- string line1 = _("The current kerning class is malformed.");- string line2 = _("Add single characters separated by space and ranges on the form A-Z.");- string line3 = _("Type “space” to kern the space character and “divis” to kern -.");+ string line1 = t_("The current kerning class is malformed.");+ string line2 = t_("Add single characters separated by space and ranges on the form A-Z.");+ string line3 = t_("Type “space” to kern the space character and “divis” to kern -."); cr.save (); cr.set_source_rgba (1, 1, 1, 1);@@ -201,7 +201,7 @@ public class KerningDisplay : FontDisplay { } private void display_kerning_value (double k) {- string kerning_label = _("Kerning:");+ string kerning_label = t_("Kerning:"); MainWindow.get_tool_tip ().show_text (@"$kerning_label $(k)"); } @@ -397,7 +397,7 @@ public class KerningDisplay : FontDisplay { bool append_char = false; Font font = BirdFont.get_current_font (); - KeyBindings.singleton.set_require_modifier (true);+ KeyBindings.set_require_modifier (true); g = MainWindow.get_current_glyph (); s.append_unichar (g.get_unichar ());@@ -21,9 +21,10 @@ public class KerningList : FontDisplay { int scroll = 0; int visible_rows = 0;- WidgetAllocation allocation = new WidgetAllocation ();+ WidgetAllocation allocation; public KerningList () {+ allocation = new WidgetAllocation (); } public override void draw (WidgetAllocation allocation, Context cr) {@@ -85,7 +86,7 @@ public class KerningList : FontDisplay { } public override string get_label () {- return _("Kerning Pairs");+ return t_("Kerning Pairs"); } public override string get_name () {@@ -20,11 +20,12 @@ namespace BirdFont { public class KerningRange : Tool { public string ranges = "";- public GlyphRange glyph_range = new GlyphRange (); + public GlyphRange glyph_range; bool malformed = false; public KerningRange (string? name = null, string tip = "", unichar key = '\0', uint modifier_flag = 0) { base (null , tip, key, modifier_flag);+ glyph_range = new GlyphRange (); if (name != null) { base.name = (!) name;@@ -46,7 +47,7 @@ public class KerningRange : Tool { active = is_over (tx, ty); if (active) {- MainWindow.get_tool_tip ().show_text (_("Right click to edit the class and left click to kern glyphs in the class."));+ MainWindow.get_tool_tip ().show_text (t_("Right click to edit the class and left click to kern glyphs in the class.")); } }); @@ -76,7 +77,7 @@ public class KerningRange : Tool { public void update_kerning_classes () { KerningDisplay kerning_display = MainWindow.get_kerning_display ();- TextListener listener = new TextListener (_("Kerning class"), ranges, _("Set"));+ TextListener listener = new TextListener (t_("Kerning class"), ranges, t_("Set")); listener.signal_text_input.connect ((text) => { set_ranges (text); Toolbox.redraw_tool_box ();@@ -30,7 +30,7 @@ public class KerningTools : ToolCollection { Expander class_tools = new Expander (); classes = new Expander (); - Tool new_kerning_class = new Tool ("kerning_class", _("Create new kerning class"));+ Tool new_kerning_class = new Tool ("kerning_class", t_("Create new kerning class")); new_kerning_class.select_action.connect ((self) => { classes.add_tool (new KerningRange (@"Kerning class $(++next_class)")); Toolbox.redraw_tool_box ();@@ -80,252 +80,25 @@ public static const uint ALT = 1 << 2; public static const uint SHIFT = 1 << 3; public static const uint LOGO = 1 << 4; -/** A list of all valid key bindings. */-public class BindingList {- static ShortCut[]? nc = null;- - public static ShortCut[] get_default_bindings () { - - if (nc == null) {- - // add all bindings to this list- ShortCut[] default_bindings = { };-- nc = default_bindings;- }- - return nc;- }-}---/** Function to be executed for each global key binding. */-public abstract class ShortCut : GLib.Object {- uint modifier = 0;- uint key = 0;- - public abstract void run ();- - public void set_modifier (uint m) {- modifier = m;- }-- public void set_key (uint k) {- key = k;- }- - public uint get_modifier () {- return modifier;- }- - public uint get_key () {- return key;- }- - public abstract uint get_default_modifier ();- public abstract uint get_default_key ();- - public abstract unowned string get_description ();- - public static EqualFunc<ShortCut> equal = (a, b) => {- if (a.get_key () != b.get_key ()) return false;- if (a.get_modifier () != b.get_modifier ()) return false;- if (a.get_description () != b.get_description ()) return false;- return true;- };- -}- public class KeyBindings { - bool modifier_ctrl = false;- bool modifier_alt = false;- bool modifier_shift = false;+ static bool modifier_ctrl = false;+ static bool modifier_alt = false;+ static bool modifier_shift = false; public static uint modifier = 0;- - bool require_modifier = false;- - /** First uint is modifer flag, second uint is keyval */- HashTable<uint, HashTable<uint, ShortCut>> short_cuts = new HashTable<uint, HashTable<uint, ShortCut>> (null, null);- - public static KeyBindings singleton;- - public KeyBindings () {- - HashFunc<uint> hash = (v) => {- return v;- };- - HashTable<uint, ShortCut> alt_ctrl_shift = new HashTable<uint, ShortCut> (hash, ShortCut.equal);- HashTable<uint, ShortCut> alt_shift = new HashTable<uint, ShortCut> (hash, ShortCut.equal);- HashTable<uint, ShortCut> ctrl_shift = new HashTable<uint, ShortCut> (hash, ShortCut.equal);- HashTable<uint, ShortCut> alt = new HashTable<uint, ShortCut> (hash, ShortCut.equal);- HashTable<uint, ShortCut> ctrl = new HashTable<uint, ShortCut> (hash, ShortCut.equal);- - // Possible modifiers- short_cuts.insert (ALT|CTRL|SHIFT, alt_ctrl_shift);- short_cuts.insert (ALT|SHIFT, alt_shift);- short_cuts.insert (CTRL|SHIFT, ctrl_shift);- short_cuts.insert (ALT, alt);- short_cuts.insert (CTRL, ctrl);- - // Add default bindings- foreach (var b in BindingList.get_default_bindings ()) {- add_binding (b);- }- - save ();- load ();- - singleton = this;- }- - public void reset () {++ public static bool require_modifier;++ public static void reset () { modifier = NONE; modifier_ctrl = false; modifier_alt = false; modifier_shift = false; }- - public void set_require_modifier (bool m) {- require_modifier = m;- }- - void load () {- File home = File.new_for_path (Environment.get_home_dir ());- File settings = home.get_child (".birdfont");- File bindings = settings.get_child ("keybindings");-- if (!bindings.query_exists ()) {- return;- }-- FileStream? bindings_file = FileStream.open ((!) bindings.get_path (), "r");- - if (bindings_file == null) {- stderr.printf ("Failed to load keybindings from file %s.\n", (!) bindings.get_path ());- return;- }- - return_if_fail (bindings_file != null);- - unowned FileStream b = (!) bindings_file;- - string? l;- l = b.read_line ();- while ((l = b.read_line ())!= null) {- string line;- - line = (!) l;- - if (line.get_char (0) == '#') {- continue;- }- - int i = 0;- int s = 0;- - i = line.index_of_char(' ', s);- string mod = line.substring (s, i - s);- - s = i + 1;- i = line.index_of_char(' ', s);- string key = line.substring (s, i - s);- - s = i + 1;- i = line.index_of_char('\n', s);- string description = line.substring (s, i - s);-- update_short_cut (mod, key, description);- }- - }- - void save () {- try {- File settings = BirdFont.get_settings_directory ();- File bindings = settings.get_child ("keybindings");- - if (bindings.query_exists ()) {- bindings.delete ();- }-- DataOutputStream os = new DataOutputStream(bindings.create(FileCreateFlags.REPLACE_DESTINATION));- uint8[] data;- long written = 0;- - StringBuilder sb = new StringBuilder ();- - sb.append_printf ("# BirdFont keybindings\n");- sb.append_printf ("# Version: 1.0\n");- - short_cuts.foreach ( (k, v) => {- v.foreach ( (k, s) => {- sb.append_printf ("%u %u %s\n", s.get_modifier (), s.get_key (), s.get_description ());- });- });- - data = sb.str.data;- - while (written < data.length) { - written += os.write (data[written:data.length]);- }- - } catch (Error e) {- stderr.printf ("Can not save key bindings. (%s)", e.message); - }- - }- - void update_short_cut (string mod, string key, string description) {- ShortCut? sc = null;- ShortCut binding;- short_cuts.foreach ( (k, ht) => {- ht.foreach ((ki, s) => {- if (s.get_description () == description) {- sc = s;- }- - // ht.remove (ki); // FIXME! why does it remove all items?- - });- });- - if (unlikely (sc == null)) {- stderr.printf ("Can not set bindings for \"%s-%s-%s-\"\n", mod, key, description);- return;- }- - binding = (!) sc; - binding.set_modifier ((uint) uint64.parse (mod));- binding.set_key ((uint) uint64.parse (key));- - add_binding (binding);- }- - void add_binding (ShortCut binding) {- uint m = binding.get_modifier ();- - if (m == 0) {- m = binding.get_default_modifier ();- binding.set_modifier (m);- }-- if (binding.get_key () == 0) {- binding.set_key (binding.get_default_key ());- }- - HashTable<uint, ShortCut>? e = short_cuts.lookup (m);- - if (e == null) {- stderr.printf ("Invalid modifier in key binding: expecting ctrl, alt or shift. Flag: (%u) \n", modifier);- return;- }- - var events = (!) e;- events.insert (binding.get_key (), binding);+ public static void set_require_modifier (bool t) {+ require_modifier = t; } private static uint get_mod_from_key (uint keyval) {@@ -349,27 +122,21 @@ public class KeyBindings { public static void set_modifier (uint mod) { modifier = mod; - singleton.modifier_ctrl = ((modifier & CTRL) > 0);- singleton.modifier_alt = ((modifier & ALT) > 0);- singleton.modifier_shift = ((modifier & SHIFT) > 0);+ modifier_ctrl = ((modifier & CTRL) > 0);+ modifier_alt = ((modifier & ALT) > 0);+ modifier_shift = ((modifier & SHIFT) > 0); } public static bool has_alt () {- return singleton.modifier_alt;+ return modifier_alt; } public static bool has_shift () {- return singleton.modifier_shift;+ return modifier_shift; } public static bool has_ctrl () {- return singleton.modifier_ctrl;- }- - public void key_release (uint keyval) {- }- - public void key_press (uint keyval) {+ return modifier_ctrl; } } @@ -20,9 +20,10 @@ public class LanguageSelectionTab : FontDisplay { int scroll = 0; int visible_rows = 0;- WidgetAllocation allocation = new WidgetAllocation ();+ WidgetAllocation allocation; public LanguageSelectionTab () {+ allocation = new WidgetAllocation (); } void select_language (int row) {@@ -88,7 +89,7 @@ public class LanguageSelectionTab : FontDisplay { } public override string get_label () {- return _("Character Set");+ return t_("Character Set"); } public override string get_name () {@@ -19,7 +19,6 @@ public class MainWindow { public static Toolbox tools; public static GlyphCanvas glyph_canvas; public static MainWindow singleton; - public static KeyBindings key_bindings; public static MenuTab menu_tab; public static FileTab file_tab; public static TooltipArea tool_tip; @@ -32,7 +31,6 @@ public class MainWindow { public MainWindow () { singleton = this; - key_bindings = new KeyBindings (); glyph_canvas = new GlyphCanvas (); tabs = new TabBar (); tools = new Toolbox (glyph_canvas, tabs); @@ -133,7 +131,7 @@ public class MainWindow { } public static void update_glyph_sequence () { - TextListener listener = new TextListener (_("Glyph sequence"), Preferences.get ("glyph_sequence"), _("Close")); + TextListener listener = new TextListener (t_("Glyph sequence"), Preferences.get ("glyph_sequence"), t_("Close")); listener.signal_text_input.connect ((text) => { Preferences.set ("glyph_sequence", text); GlyphCanvas.redraw (); @@ -186,7 +184,7 @@ public class MainWindow { } public static string translate (string s) { - return _(s); + return t_(s); } public static void set_status (string s) { @@ -38,7 +38,7 @@ public class MenuTab : FontDisplay { } public override string get_label () {- return _("Menu");+ return t_("Menu"); } public override string get_name () {@@ -67,7 +67,7 @@ public class MenuTab : FontDisplay { return false; } - fn = MainWindow.file_chooser_save (_("Save"));+ fn = MainWindow.file_chooser_save (t_("Save")); if (fn != null) { f = (!) fn;@@ -187,7 +187,7 @@ public class MenuTab : FontDisplay { } f = BirdFont.get_current_font ();- fn = MainWindow.file_chooser_open (_("Open"));+ fn = MainWindow.file_chooser_open (t_("Open")); if (fn != null) { f.delete_backup ();@@ -34,7 +34,7 @@ class MoveTool : Tool { static double selection_box_center_y = 0; public MoveTool (string n) {- base (n, _("Move paths"), 'm', CTRL);+ base (n, t_("Move paths"), 'm', CTRL); select_action.connect((self) => { });@@ -68,7 +68,7 @@ class GsubTable : Table { // MarkFilteringSet - fd.append (get_pair_pos_format1 ());+ //fd.append (get_clig_data ()); fd.pad (); this.font_data = fd;@@ -822,31 +822,6 @@ GString* get_bf_font (FT_Face face, char* file, int* err) { return bf; } -int validate_font (FT_Face face) {- // these tables can be validated- const FT_Byte* BASE_table = NULL; - const FT_Byte* GDEF_table = NULL;- const FT_Byte* GPOS_table = NULL;- const FT_Byte* GSUB_table = NULL;- const FT_Byte* JSTF_table = NULL;- int error;-- error = FT_OpenType_Validate (face, FT_VALIDATE_BASE | FT_VALIDATE_GDEF | FT_VALIDATE_GPOS | FT_VALIDATE_GSUB | FT_VALIDATE_JSTF, &BASE_table, &GDEF_table, &GPOS_table, &GSUB_table, &JSTF_table);-- if (error) {- g_warning ("Freetype validation error %d\n", error);- return error;- } - - FT_OpenType_Free (face, BASE_table);- FT_OpenType_Free (face, GDEF_table);- FT_OpenType_Free (face, GPOS_table);- FT_OpenType_Free (face, GSUB_table);- FT_OpenType_Free (face, JSTF_table);- - return error;-}- /** Load typeface with freetype2 and return the result as a bf font. * Parameter err will be set to non zero vaule if an error occurs. */@@ -894,32 +869,3 @@ GString* load_freetype_font (char* file, int* err) { return bf; } -/** Validate font a font with FreeType */-guint validate_freetype_font (char* file) {- FT_Library library;- FT_Face face;- int error;- - error = FT_Init_FreeType (&library);- if (error != OK) {- g_warning ("Freetype init error %d\n", error);- return FALSE;- }-- error = FT_New_Face (library, file, 0, &face);- if (error) {- g_warning ("Freetype font face error %d\n", error);- return FALSE;- }- - error = validate_font (face);- if (error) {- g_warning ("Validation failed.\n", error);- return FALSE;- }-- FT_Done_Face ( face );- FT_Done_FreeType( library );- - return TRUE;-}@@ -106,7 +106,7 @@ public class OverView : FontDisplay { public static void search () { OverView ow = MainWindow.get_overview ();- TextListener listener = new TextListener (_("Search"), ow.search_query, _("Filter"));+ TextListener listener = new TextListener (t_("Search"), ow.search_query, t_("Filter")); listener.signal_text_input.connect ((text) => { OverView o = MainWindow.get_overview ();@@ -181,7 +181,7 @@ public class OverView : FontDisplay { public override void selected_canvas () { redraw_area (0, 0, allocation.width, allocation.height);- KeyBindings.singleton.set_require_modifier (true);+ KeyBindings.set_require_modifier (true); update_scrollbar (); } @@ -231,7 +231,7 @@ public class OverView : FontDisplay { } public override string get_label () {- return _("Overview");+ return t_("Overview"); } public override string get_name () {@@ -369,7 +369,7 @@ public class OverView : FontDisplay { cr.set_source_rgba (156/255.0, 156/255.0, 156/255.0, 1); cr.move_to (30, 40); cr.set_font_size (18);- cr.show_text (_("No glyphs in this view."));+ cr.show_text (t_("No glyphs in this view.")); cr.restore (); } @@ -902,7 +902,7 @@ public class OverView : FontDisplay { } else if (line.has_prefix ("\tx (")) { if (!see_also) { i++;- draw_info_line (_("See also:"), cr, x, y, i);+ draw_info_line (t_("See also:"), cr, x, y, i); i++; see_also = true; }@@ -21,12 +21,16 @@ public class OverWriteDialogListener : GLib.Object { public static bool dont_ask_again = false; - public string message = _("Overwrite TTF file?");- public string overwrite_message = _("Overwrite");- public string cancel_message = _("Cancel");- public string dont_ask_again_message = _("Yes, don't ask again.");+ public string message;+ public string overwrite_message;+ public string cancel_message;+ public string dont_ask_again_message; public OverWriteDialogListener () {+ message = t_("Overwrite TTF file?");+ overwrite_message = t_("Overwrite");+ cancel_message = t_("Cancel");+ dont_ask_again_message = t_("Yes, don't ask again."); } public void overwrite () {@@ -24,7 +24,7 @@ public enum Direction { public class Path { - public List<EditPoint> points = new List<EditPoint> ();+ public List<EditPoint> points; EditPoint? last_point = null; EditPoint? second_last_point = null;@@ -84,6 +84,7 @@ public class Path { public Path () { string width;+ points = new List<EditPoint> (); new_quadratic_points = new List<EditPoint> (); if (edit_point_image == null) {@@ -15,9 +15,10 @@ namespace BirdFont { public class PathList : GLib.Object {- public List<Path> paths = new List<Path> ();+ public List<Path> paths; public PathList () {+ paths = new List<Path> (); } public void append (PathList pl) {@@ -26,16 +26,16 @@ public class PenTool : Tool { public static bool edit_active_corner = false; - public static List<PointSelection> selected_points = new List<PointSelection> (); + public static List<PointSelection> selected_points; - public static EditPointHandle active_handle = new EditPointHandle.empty ();- public static EditPointHandle selected_handle = new EditPointHandle.empty ();- public static PointSelection handle_selection = new PointSelection.empty ();+ public static EditPointHandle active_handle;+ public static EditPointHandle selected_handle;+ public static PointSelection handle_selection; - public static EditPoint? active_edit_point = new EditPoint ();- public static Path active_path = new Path ();+ public static EditPoint? active_edit_point;+ public static Path active_path; - public static EditPoint selected_point = new EditPoint ();+ public static EditPoint selected_point; public static bool move_selected_handle = false; @@ -57,19 +57,32 @@ public class PenTool : Tool { /** Move curve handle instead of control point. */ private bool last_selected_is_handle = false; - static List<Path> clockwise = new List<Path> ();- static List<Path> counter_clockwise = new List<Path> ();+ static List<Path> clockwise;+ static List<Path> counter_clockwise; public PenTool (string name) { string click_to_add_points;++ selected_points = new List<PointSelection> (); ++ active_handle = new EditPointHandle.empty ();+ selected_handle = new EditPointHandle.empty ();+ handle_selection = new PointSelection.empty (); + active_edit_point = new EditPoint ();+ active_path = new Path ();+ + selected_point = new EditPoint ();+ clockwise = new List<Path> ();+ counter_clockwise = new List<Path> ();+ if (BirdFont.mac) {- click_to_add_points = _("Right click or use left command key and click to add new points");+ click_to_add_points = t_("Right click or use left command key and click to add new points"); } else {- click_to_add_points = _("Right click to add new points, left click to move points");+ click_to_add_points = t_("Right click to add new points, left click to move points"); } - base (name, click_to_add_points + " " + _("and double click to add new point on path."), ',', CTRL);+ base (name, click_to_add_points + " " + t_("and double click to add new point on path."), ',', CTRL); tie_icon = Icons.get_icon ("tie_is_active.png"); @@ -22,7 +22,7 @@ public class Preferences { public static bool draw_boundries = false; public Preferences () {- data = new HashMap<string, string> ();+ data = new Gee.HashMap<string, string> (); } public static void set_last_file (string fn) {@@ -80,27 +80,46 @@ public class Preferences { } public static void load () {- File app_dir = BirdFont.get_settings_directory ();- File settings = app_dir.get_child ("settings");+ File app_dir;+ File settings;+ FileStream? settings_file;+ unowned FileStream b;+ string? l;+ + printd ("get app");+ app_dir = BirdFont.get_settings_directory ();+ + if (is_null (app_dir)) {+ warning ("No app directory.");+ return;+ } + printd ("get settings file");+ settings = app_dir.get_child ("settings");++ if (is_null (settings)) {+ warning ("No setting directory.");+ return;+ }++ printd ("create map"); data = new HashMap<string, string> (); + printd ("look at settings"); if (!settings.query_exists ()) { return; }-- FileStream? settings_file = FileStream.open ((!) settings.get_path (), "r");+ + printd ("open settings file");+ settings_file = FileStream.open ((!) settings.get_path (), "r"); if (settings_file == null) { stderr.printf ("Failed to load settings from file %s.\n", (!) settings.get_path ()); return; } - return_if_fail (settings_file != null);- - unowned FileStream b = (!) settings_file;- - string? l;+ printd ("parse settings file");+ b = (!) settings_file; l = b.read_line (); while ((l = b.read_line ())!= null) { string line;@@ -24,7 +24,7 @@ public class Preview : FontDisplay { } public override string get_label () {- return _("Preview");+ return t_("Preview"); } public override void selected_canvas () {@@ -27,7 +27,7 @@ public class RectangleTool : Tool { bool resize = false; public RectangleTool (string n) {- base (n, _("Rectangle"));+ base (n, t_("Rectangle")); press_action.connect((self, b, x, y) => { press (b, x, y);@@ -36,7 +36,7 @@ class ResizeTool : Tool { static double last_rotate = 0; public ResizeTool (string n) {- base (n, _("Resize and rotate paths"));+ base (n, t_("Resize and rotate paths")); resize_handle = Icons.get_icon ("resize_handle.png"); @@ -24,9 +24,9 @@ public class SaveDialogListener : GLib.Object { public string save_message; public SaveDialogListener () {- this.message = _("Save?");- this.save_message = _("Save");- this.discard_message = _("Discard");+ this.message = t_("Save?");+ this.save_message = t_("Save");+ this.discard_message = t_("Discard"); } public void save () {@@ -105,7 +105,7 @@ public class SpinButton : Tool { } public void set_from_text () {- TextListener listener = new TextListener (_("Set"), get_display_value (), _("Close"));+ TextListener listener = new TextListener (t_("Set"), get_display_value (), t_("Close")); listener.signal_text_input.connect ((text) => { int new_value = (int) Math.rint (double.parse (text) * 1000);@@ -21,7 +21,7 @@ public class TabBar : GLib.Object { int width = 0; int height = 0; - public List<Tab> tabs = new List<Tab> ();+ public List<Tab> tabs; static const int NO_TAB = -1; static const int NEXT_TAB = -2;@@ -51,6 +51,8 @@ public class TabBar : GLib.Object { ImageSurface to_previous_tab; public TabBar () {+ // tabs = new List<Tab> ();+ tab1_left = Icons.get_icon ("tab1_left.png"); tab1_right = Icons.get_icon ("tab1_right.png"); @@ -78,11 +78,6 @@ class TestCases { warning ("File does not exist."); } - valid = validate_freetype_font ((!) f.get_path ());- if (!valid) {- warning ("The font does not pass freetype validation.");- }- data = load_freetype_font ((!) f.get_path (), out error); if (error != 0) { warning ("Failed to load font.");@@ -23,9 +23,9 @@ public class Toolbox : GLib.Object { public DrawingTools drawing_tools; public KerningTools kerning_tools; - Tool current_tool = new Tool ("no_icon");+ Tool current_tool; - public Tool press_tool = new Tool (null);+ public Tool press_tool; public signal void redraw (int x, int y, int w, int h); @@ -37,6 +37,10 @@ public class Toolbox : GLib.Object { bool scrolling_toolbox = false; public Toolbox (GlyphCanvas glyph_canvas, TabBar tab_bar) {+ current_tool = new Tool ("no_icon");++ press_tool = new Tool (null);+ drawing_tools = new DrawingTools (glyph_canvas); kerning_tools = new KerningTools (); current_set = drawing_tools;@@ -21,13 +21,15 @@ public class VersionList : DropMenu { int versions = 1; int current_version = 0;- public List<Glyph> glyphs = new List<Glyph> ();+ public List<Glyph> glyphs; public VersionList (Glyph? g = null) { base ("version");+ glyphs = new List<Glyph> ();+ set_direction (MenuDirection.POP_UP); - MenuAction ma = add_item (_("New version"));+ MenuAction ma = add_item (t_("New version")); ma.has_delete_button = false; ma.action = (self) => { return_if_fail (self.parent != null);@@ -167,7 +169,7 @@ public class VersionList : DropMenu { versions++; glyphs.append (new_version); - ma = add_item (_("Version") + @" $(versions - 1)");+ ma = add_item (t_("Version") + @" $(versions - 1)"); ma.index = (int) glyphs.length () - 1; ma.action = (self) => {@@ -20,11 +20,13 @@ class ZoomTool : Tool { int zoom_area_begin_y = -1; int view_index = 0;- List<Tab> views = new List<Tab> ();+ List<Tab> views; public ZoomTool (string n) { base (n, "Zoom", 'z'); + views = new List<Tab> ();+ select_action.connect((self) => { }); @@ -37,7 +37,7 @@ def libbirdfont(prefix, cc, cflags, ldflags, valac, valaflags, library): -H build/libbirdfont/birdfont.h \ libbirdfont/*.vala \ libbirdfont/OpenFontFormat/*.vala \- --pkg gee-1.0 \+ --pkg gee-0.8 \ --pkg libxml-2.0 \ --pkg gio-2.0 \ --pkg cairo \@@ -46,41 +46,44 @@ def libbirdfont(prefix, cc, cflags, ldflags, valac, valaflags, library): #copy c sources run("cp libbirdfont/OpenFontFormat/*.c build/libbirdfont/") - run(cc + " " + cflags + """ \- -c build/libbirdfont/*.c \- -fPIC \- -D 'GETTEXT_PACKAGE="birdfont"' \- $(pkg-config --cflags gee-1.0) \- $(pkg-config --cflags libxml-2.0) \- $(pkg-config --cflags gio-2.0) \- $(pkg-config --cflags cairo) \- $(pkg-config --cflags glib-2.0) \- $(pkg-config --cflags gdk-pixbuf-2.0) \- -I ./build/mac/birdfont""")- run("mv ./*.o build/libbirdfont/ ")-- run(cc + " " + ldflags + """ \- -shared \- build/libbirdfont/*.o \- $(freetype-config --libs) \- $(pkg-config --libs gee-1.0) \- $(pkg-config --libs libxml-2.0) \- $(pkg-config --libs gio-2.0) \- $(pkg-config --libs cairo) \- $(pkg-config --libs glib-2.0) \- $(pkg-config --libs gdk-pixbuf-2.0) \- -o """ + library)- run("mv " + library + " build/bin/")- - if os.path.exists("build/bin/libbirdfont.so"):- run ("cd build/bin && unlink libbirdfont.so")-- # create link to the versioned library- if library.find ('.so') > -1:- run ("""cd build/bin && ln -s """ + library + " libbirdfont.so")- elif library.find ('.dylib') > -1:- run ("""cd build/bin && ln -s """ + library + " libbirdfont.dylib")+ if cc == "":+ print ("Skipping compilation");+ else:+ run(cc + " " + cflags + """ \+ -c build/libbirdfont/*.c \+ -fPIC \+ -D 'GETTEXT_PACKAGE="birdfont"' \+ $(pkg-config --cflags gee-0.8) \+ $(pkg-config --cflags libxml-2.0) \+ $(pkg-config --cflags gio-2.0) \+ $(pkg-config --cflags cairo) \+ $(pkg-config --cflags glib-2.0) \+ $(pkg-config --cflags gdk-pixbuf-2.0) \+ -I ./build/mac/birdfont""")+ run("mv ./*.o build/libbirdfont/ ")++ run(cc + " " + ldflags + """ \+ -shared \+ build/libbirdfont/*.o \+ $(freetype-config --libs) \+ $(pkg-config --libs gee-0.8) \+ $(pkg-config --libs libxml-2.0) \+ $(pkg-config --libs gio-2.0) \+ $(pkg-config --libs cairo) \+ $(pkg-config --libs glib-2.0) \+ $(pkg-config --libs gdk-pixbuf-2.0) \+ -o """ + library)+ run("mv " + library + " build/bin/") + if os.path.exists("build/bin/libbirdfont.so"):+ run ("cd build/bin && unlink libbirdfont.so")++ # create link to the versioned library+ if library.find ('.so') > -1:+ run ("""cd build/bin && ln -s """ + library + " libbirdfont.so")+ elif library.find ('.dylib') > -1:+ run ("""cd build/bin && ln -s """ + library + " libbirdfont.dylib")+ def birdfont_export(prefix, cc, cflags, ldflags, valac, valaflags, library): # birdfont-export@@ -92,7 +95,7 @@ def birdfont_export(prefix, cc, cflags, ldflags, valac, valaflags, library): --enable-experimental \ --define=MAC birdfont-export/* \ --vapidir=./ \- --pkg gee-1.0 \+ --pkg gee-0.8 \ --pkg libxml-2.0 \ --pkg gio-2.0 \ --pkg cairo \@@ -104,7 +107,7 @@ def birdfont_export(prefix, cc, cflags, ldflags, valac, valaflags, library): run(cc + " " + cflags + """ \ -c ./build/libbirdfont/birdfont.h build/birdfont-export/*.c \ -D 'GETTEXT_PACKAGE="birdfont"' \- $(pkg-config --cflags gee-1.0) \+ $(pkg-config --cflags gee-0.8) \ $(pkg-config --cflags libxml-2.0) \ $(pkg-config --cflags gio-2.0) \ $(pkg-config --cflags cairo) \@@ -116,7 +119,7 @@ def birdfont_export(prefix, cc, cflags, ldflags, valac, valaflags, library): run(cc + " " + ldflags + " \ build/birdfont-export/*.o \ -Lbuild/bin/ -lbirdfont \- $(pkg-config --libs gee-1.0) \+ $(pkg-config --libs gee-0.8) \ $(pkg-config --libs libxml-2.0) \ $(pkg-config --libs gio-2.0) \ $(pkg-config --libs cairo) \@@ -137,7 +140,7 @@ def birdfont_gtk(prefix, cc, cflags, ldflags, valac, valaflags, library): --enable-experimental-non-null \ --enable-experimental \ --vapidir=./ \- --pkg gee-1.0 \+ --pkg gee-0.8 \ --pkg libxml-2.0 \ --pkg gio-2.0 \ --pkg cairo \@@ -151,7 +154,7 @@ def birdfont_gtk(prefix, cc, cflags, ldflags, valac, valaflags, library): run(cc + " " + cflags + """\ -c ./build/libbirdfont/birdfont.h build/birdfont/*.c \ -D 'GETTEXT_PACKAGE="birdfont"' \- $(pkg-config --cflags gee-1.0) \+ $(pkg-config --cflags gee-0.8) \ $(pkg-config --cflags libxml-2.0) \ $(pkg-config --cflags gio-2.0) \ $(pkg-config --cflags cairo) \@@ -164,7 +167,7 @@ def birdfont_gtk(prefix, cc, cflags, ldflags, valac, valaflags, library): run(cc + " " + ldflags + """ \ build/birdfont/*.o \ -Lbuild/bin/ -lbirdfont \- $(pkg-config --libs gee-1.0) \+ $(pkg-config --libs gee-0.8) \ $(pkg-config --libs libxml-2.0) \ $(pkg-config --libs gio-2.0) \ $(pkg-config --libs cairo) \