Clone in a terminal:
Commit db34855
Johan Mattsson - 2013-09-18T21:16:44+00:00
db34855e6f54195d3fbb5260e03be5003773069ejohan.mattsson.m@gmail.com

android port of libbirdfont

Changed files (52)

Diff

diff --git a/birdfont/Main.vala b/birdfont/Main.valaindex 03fadb5..08d8fe3 100644--- a/birdfont/Main.vala+++ b/birdfont/Main.vala@@ -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);diff --git a/dodo.py b/dodo.pyindex d20e4ed..c48c4c2 100644--- a/dodo.py+++ b/dodo.py@@ -45,7 +45,7 @@ LIBS = [     'cairo',     'gdk-pixbuf-2.0',     'webkit-1.0',-    'gee-1.0'+    'gee-0.8'     ]  def task_build ():diff --git a/libbirdfont/Argument.vala b/libbirdfont/Argument.valaindex d534ee7..7386dd3 100644--- a/libbirdfont/Argument.vala+++ b/libbirdfont/Argument.vala@@ -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"); 	}diff --git a/libbirdfont/BackgroundSelection.vala b/libbirdfont/BackgroundSelection.valaindex e234df5..678b1f1 100644--- a/libbirdfont/BackgroundSelection.vala+++ b/libbirdfont/BackgroundSelection.vala@@ -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) {diff --git a/libbirdfont/BackgroundTool.vala b/libbirdfont/BackgroundTool.valaindex 726f813..2163eaf 100644--- a/libbirdfont/BackgroundTool.vala+++ b/libbirdfont/BackgroundTool.vala@@ -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;diff --git a/libbirdfont/BirdFont.vala b/libbirdfont/BirdFont.valaindex a1bcf37..7540ad4 100644--- a/libbirdfont/BirdFont.vala+++ b/libbirdfont/BirdFont.vala@@ -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  }diff --git a/libbirdfont/BirdFontFile.vala b/libbirdfont/BirdFontFile.valaindex e1a5339..b58af4d 100644--- a/libbirdfont/BirdFontFile.vala+++ b/libbirdfont/BirdFontFile.vala@@ -35,6 +35,8 @@ class BirdFontFile { 		Xml.Doc* doc; 		Xml.Node* root; 		+		printd (@"Init xml parser.\n");+		 		Parser.init (); 		 		printd (@"Loading $path\n");diff --git a/libbirdfont/CharDatabase.vala b/libbirdfont/CharDatabase.valaindex 20c455b..a1c29f3 100644--- a/libbirdfont/CharDatabase.vala+++ b/libbirdfont/CharDatabase.vala@@ -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) {diff --git a/libbirdfont/CircleTool.vala b/libbirdfont/CircleTool.valaindex 9d5adb9..3896db4 100644--- a/libbirdfont/CircleTool.vala+++ b/libbirdfont/CircleTool.vala@@ -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);diff --git a/libbirdfont/CutBackgroundTool.vala b/libbirdfont/CutBackgroundTool.valaindex a131498..6cef225 100644--- a/libbirdfont/CutBackgroundTool.vala+++ b/libbirdfont/CutBackgroundTool.vala@@ -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 	} } diff --git a/libbirdfont/DefaultCharactersSet.vala b/libbirdfont/DefaultCharactersSet.valaindex 082102d..b6f074f 100644--- a/libbirdfont/DefaultCharactersSet.vala+++ b/libbirdfont/DefaultCharactersSet.vala@@ -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 ());diff --git a/libbirdfont/DescriptionTab.vala b/libbirdfont/DescriptionTab.valaindex 9e3f294..c140c91 100644--- a/libbirdfont/DescriptionTab.vala+++ b/libbirdfont/DescriptionTab.vala@@ -26,7 +26,7 @@ public class DescriptionTab : FontDisplay { 	}  	public override string get_label () {-		return _("Description");+		return t_("Description"); 	} } diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex 748ca77..63c620c 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -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) => {diff --git a/libbirdfont/ExportTool.vala b/libbirdfont/ExportTool.valaindex 48cddfb..caae268 100644--- a/libbirdfont/ExportTool.vala+++ b/libbirdfont/ExportTool.vala@@ -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 ()); 	} 		diff --git a/libbirdfont/FileTab.vala b/libbirdfont/FileTab.valaindex 38b50e2..24dd06c 100644--- a/libbirdfont/FileTab.vala+++ b/libbirdfont/FileTab.vala@@ -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 () {diff --git a/libbirdfont/Font.vala b/libbirdfont/Font.valaindex 4657c8d..9774c08 100644--- a/libbirdfont/Font.vala+++ b/libbirdfont/Font.vala@@ -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;diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 14af745..2ecf506 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -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); 	}diff --git a/libbirdfont/GlyphBackgroundImage.vala b/libbirdfont/GlyphBackgroundImage.valaindex 7b46ff1..d7d3f1f 100644--- a/libbirdfont/GlyphBackgroundImage.vala+++ b/libbirdfont/GlyphBackgroundImage.vala@@ -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) {diff --git a/libbirdfont/GlyphCanvas.vala b/libbirdfont/GlyphCanvas.valaindex e5062be..c7a2d68 100644--- a/libbirdfont/GlyphCanvas.vala+++ b/libbirdfont/GlyphCanvas.vala@@ -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 () {diff --git a/libbirdfont/GlyphRange.vala b/libbirdfont/GlyphRange.valaindex bd7e9a3..255aa2d 100644--- a/libbirdfont/GlyphRange.vala+++ b/libbirdfont/GlyphRange.vala@@ -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 () {diff --git a/libbirdfont/GridTool.vala b/libbirdfont/GridTool.valaindex aecc0f1..5ef9d3c 100644--- a/libbirdfont/GridTool.vala+++ b/libbirdfont/GridTool.vala@@ -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") {diff --git a/libbirdfont/Icons.vala b/libbirdfont/Icons.valaindex 71e95e5..58ba405 100644--- a/libbirdfont/Icons.vala+++ b/libbirdfont/Icons.vala@@ -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) {diff --git a/libbirdfont/ImportSvg.vala b/libbirdfont/ImportSvg.valaindex 27fdb0d..4e73818 100644--- a/libbirdfont/ImportSvg.vala+++ b/libbirdfont/ImportSvg.vala@@ -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;diff --git a/libbirdfont/IntersectionList.vala b/libbirdfont/IntersectionList.valaindex 9868a80..d668a49 100644--- a/libbirdfont/IntersectionList.vala+++ b/libbirdfont/IntersectionList.vala@@ -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;diff --git a/libbirdfont/KerningDisplay.vala b/libbirdfont/KerningDisplay.valaindex 9dcb106..a60635d 100644--- a/libbirdfont/KerningDisplay.vala+++ b/libbirdfont/KerningDisplay.vala@@ -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 ());diff --git a/libbirdfont/KerningList.vala b/libbirdfont/KerningList.valaindex a8a05c9..8d5ed78 100644--- a/libbirdfont/KerningList.vala+++ b/libbirdfont/KerningList.vala@@ -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 () {diff --git a/libbirdfont/KerningRange.vala b/libbirdfont/KerningRange.valaindex 17dda99..44aad28 100644--- a/libbirdfont/KerningRange.vala+++ b/libbirdfont/KerningRange.vala@@ -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 ();diff --git a/libbirdfont/KerningTools.vala b/libbirdfont/KerningTools.valaindex 9b5b13b..5c0032d 100644--- a/libbirdfont/KerningTools.vala+++ b/libbirdfont/KerningTools.vala@@ -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 ();diff --git a/libbirdfont/KeyBindings.vala b/libbirdfont/KeyBindings.valaindex 56915cb..f928c4b 100644--- a/libbirdfont/KeyBindings.vala+++ b/libbirdfont/KeyBindings.vala@@ -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; 	} } diff --git a/libbirdfont/LanguageSelectionTab.vala b/libbirdfont/LanguageSelectionTab.valaindex d766c8f..687f8fa 100644--- a/libbirdfont/LanguageSelectionTab.vala+++ b/libbirdfont/LanguageSelectionTab.vala@@ -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 () {diff --git a/libbirdfont/MainWindow.vala b/libbirdfont/MainWindow.valaindex 313dc46..2e121b6 100644--- a/libbirdfont/MainWindow.vala+++ b/libbirdfont/MainWindow.vala@@ -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) {
diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex 295cef1..b5dd914 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -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 ();diff --git a/libbirdfont/MoveTool.vala b/libbirdfont/MoveTool.valaindex e4ef23a..5768f81 100644--- a/libbirdfont/MoveTool.vala+++ b/libbirdfont/MoveTool.vala@@ -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) => { 		});diff --git a/libbirdfont/OpenFontFormat/Gsub.vala b/libbirdfont/OpenFontFormat/Gsub.valaindex bd5a51c..371511a 100644--- a/libbirdfont/OpenFontFormat/Gsub.vala+++ b/libbirdfont/OpenFontFormat/Gsub.vala@@ -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;diff --git a/libbirdfont/OpenFontFormat/load_font.c b/libbirdfont/OpenFontFormat/load_font.cindex c42a0a1..7ba0234 100644--- a/libbirdfont/OpenFontFormat/load_font.c+++ b/libbirdfont/OpenFontFormat/load_font.c@@ -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;-}diff --git a/libbirdfont/OverView.vala b/libbirdfont/OverView.valaindex 19a66d7..19d1087 100644--- a/libbirdfont/OverView.vala+++ b/libbirdfont/OverView.vala@@ -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; 					}diff --git a/libbirdfont/OverWriteDialogListener.vala b/libbirdfont/OverWriteDialogListener.valaindex e5d9214..0cc1349 100644--- a/libbirdfont/OverWriteDialogListener.vala+++ b/libbirdfont/OverWriteDialogListener.vala@@ -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 () {diff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex 43fe7e6..4a32baf 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -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) {diff --git a/libbirdfont/PathList.vala b/libbirdfont/PathList.valaindex 1546b30..3382470 100644--- a/libbirdfont/PathList.vala+++ b/libbirdfont/PathList.vala@@ -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) {diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex d71c2a4..94894ff 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -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"); 		diff --git a/libbirdfont/Preferences.vala b/libbirdfont/Preferences.valaindex a361a92..bfd6f83 100644--- a/libbirdfont/Preferences.vala+++ b/libbirdfont/Preferences.vala@@ -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;diff --git a/libbirdfont/Preview.vala b/libbirdfont/Preview.valaindex b2ecc7e..0ab10c3 100644--- a/libbirdfont/Preview.vala+++ b/libbirdfont/Preview.vala@@ -24,7 +24,7 @@ public class Preview : FontDisplay { 	}  	public override string get_label () {-		return _("Preview");+		return t_("Preview"); 	} 	 	public override void selected_canvas () {diff --git a/libbirdfont/RectangleTool.vala b/libbirdfont/RectangleTool.valaindex 0c1a082..b77d065 100644--- a/libbirdfont/RectangleTool.vala+++ b/libbirdfont/RectangleTool.vala@@ -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);diff --git a/libbirdfont/ResizeTool.vala b/libbirdfont/ResizeTool.valaindex 0f49a5f..706e5f2 100644--- a/libbirdfont/ResizeTool.vala+++ b/libbirdfont/ResizeTool.vala@@ -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"); 	diff --git a/libbirdfont/SaveDialogListener.vala b/libbirdfont/SaveDialogListener.valaindex 0002e24..d4039fa 100644--- a/libbirdfont/SaveDialogListener.vala+++ b/libbirdfont/SaveDialogListener.vala@@ -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 () {diff --git a/libbirdfont/SpinButton.vala b/libbirdfont/SpinButton.valaindex 7a7dc85..4178ff0 100644--- a/libbirdfont/SpinButton.vala+++ b/libbirdfont/SpinButton.vala@@ -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);diff --git a/libbirdfont/TabBar.vala b/libbirdfont/TabBar.valaindex 23dcf38..3269b1b 100644--- a/libbirdfont/TabBar.vala+++ b/libbirdfont/TabBar.vala@@ -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"); diff --git a/libbirdfont/TestCases.vala b/libbirdfont/TestCases.valaindex 4201942..d5b2a40 100644--- a/libbirdfont/TestCases.vala+++ b/libbirdfont/TestCases.vala@@ -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.");diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex b3fcc5f..6a53796 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -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;diff --git a/libbirdfont/VersionList.vala b/libbirdfont/VersionList.valaindex e05837c..1038866 100644--- a/libbirdfont/VersionList.vala+++ b/libbirdfont/VersionList.vala@@ -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) => {diff --git a/libbirdfont/ZoomTool.vala b/libbirdfont/ZoomTool.valaindex 9aa6268..3284b12 100644--- a/libbirdfont/ZoomTool.vala+++ b/libbirdfont/ZoomTool.vala@@ -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) => { 		}); diff --git a/scripts/build.py b/scripts/build.pyindex 640b1c4..4cf566f 100644--- a/scripts/build.py+++ b/scripts/build.py@@ -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) \

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112