Clone in a terminal:
Commit 0455097
Johan Mattsson - 2014-07-25T21:12:29+00:00
04550975dc48bf657b757f9702a2fc2fa862bc3bjohan.mattsson.m@gmail.com

Resize recent file list

Changed files (4)

Diff

diff --git a/fonts/BetecknaBirdfont.bf b/fonts/BetecknaBirdfont.bfindex cc2d36c..2186a24 100644--- a/fonts/BetecknaBirdfont.bf+++ b/fonts/BetecknaBirdfont.bf@@ -21,8 +21,9 @@ 	<bottom_limit>-45.0000000000</bottom_limit> </horizontal> +<grid width="4.000"/> <grid width="2.000"/>-<grid width="2.000"/>+<grid width="1.000"/>  <background scale="1.000" /> @@ -90,8 +91,8 @@ <collection unicode="U+62"> 	<selected id="1"/> 	<glyph id="1" left="-28" right="28">-		<path stroke="0" data="B -3.0632736896,54.2018621383 C 5.7948279768,54.3353689956 19.0060231042,52.6652557001 18.7014476218,35.7891845426 T C 18.5211637044,29.5913970365 13.0005865555,24.0397518485 8.6520487147,21.8252938322 C 14.6857682047,21.9615706993 23.8450576446,16.7779004800 23.8314148350,1.3831517557 T C 23.8239986629,-6.9853668714 16.3493427440,-17.5135207530 6.9766390241,-17.7976144353 T C -2.0224800542,-18.0703844868 -11.1208475086,-17.7841499544 -20.1695907750,-17.7774177139 C -20.2336704438,6.1962897338 -20.2763902231,22.1787613657 -20.3618297816,54.1437046293 C -14.5956444176,54.1630904657 -11.5617830028,54.0710814354 -3.0632736896,54.2018621383 T" />-		<path stroke="0" data="B -12.0179219290,46.4176228612 C -11.9632962485,41.5490582444 -11.9087753294,36.6898306008 -11.8540448873,31.8119290108 C -11.8260885116,29.3202910096 -11.7979226127,26.8099790620 -11.7698614755,24.3090040876 C -8.4103333571,24.3060078453 -5.0663340482,24.2527349780 -1.6912771202,24.5851803279 T C 6.4515198054,25.3872512355 8.5017600885,30.0286803419 8.3262966502,35.1462295082 T C 8.3167956293,35.4233353385 8.3016579709,35.6939309288 8.2826759385,35.9380572435 C 7.7613265953,42.6472451499 3.7839729499,45.2540935512 0.2706091111,46.0597179970 T C -3.5515471862,46.9361494427 -8.1420301437,46.6967474693 -12.0179219290,46.4176228612" />+		<path stroke="0" data="B -3.0632736896,54.2018621383 C 5.7948279768,54.3353689956 19.1922184179,52.6608675637 18.7014476218,35.7891845426 T C 18.5211637044,29.5913970365 13.0005865555,24.0397518485 8.6520487147,21.8252938322 C 14.6857682047,21.9615706993 23.8450576446,16.7779004800 23.8314148350,1.3831517557 T C 23.8239986629,-6.9853668714 16.3493427440,-17.5135207530 6.9766390241,-17.7976144353 T C -2.0224800542,-18.0703844868 -11.1208475086,-17.7841499544 -20.1695907750,-17.7774177139 C -20.2336704438,6.1962897338 -20.2763902231,22.1787613657 -20.3618297816,54.1437046293 C -14.5956444176,54.1630904657 -11.5617830028,54.0710814354 -3.0632736896,54.2018621383 T" />+		<path stroke="0" data="B -12.0179219290,46.4176228612 C -11.9632962485,41.5490582444 -11.9087753294,36.6898306008 -11.8540448873,31.8119290108 C -11.8260885116,29.3202910096 -11.7979226127,26.8099790620 -11.7698614755,24.3090040876 C -8.4103333571,24.3060078453 -5.0663340482,24.2527349780 -1.6912771202,24.5851803279 T C 6.4515198054,25.3872512355 8.2472649287,29.3924424442 8.3262966502,35.1462295082 T C 8.3301047426,35.4234720176 8.3016579709,35.6939309288 8.2826759385,35.9380572435 C 8.3975644929,42.5199975704 5.2009893181,46.7670312215 -1.7653521614,46.5687083151 M -12.0179219290,46.4176228612" /> 		<path stroke="0" data="B -11.3722437047,16.7339821745 M -11.1970230567,-9.3173245453 C -5.7009051923,-9.2764278984 -0.2667860464,-9.3756446253 5.2913305364,-9.1946346043 T C 8.0018326111,-9.1063622498 13.1178350121,-6.1208384734 13.2881020377,2.7175092713 T C 13.4412218602,10.6657672093 8.4124772174,16.6504385741 2.5892517258,16.6503323185 C -3.2982054978,16.8163025250 -6.7184118946,16.7060988892 -11.3722437047,16.7339821745" /> 	</glyph> </collection>@@ -126,7 +127,7 @@ <collection unicode="U+67"> 	<selected id="1"/> 	<glyph id="1" left="-28" right="56">-		<path stroke="0" data="B 31.9319923372,48.4128975279 M 27.8687739464,42.9282231984 C 24.1855044700,45.7756050630 16.3912907006,47.9870932337 11.0660919540,47.9033189838 T C -6.1375421434,47.6326771523 -16.9395948168,36.9786984631 -17.5373563218,18.5086829685 T C -17.9561319327,5.5690875661 -7.6924155930,-9.7788882388 9.4971264368,-9.2231177978 T C 20.5749565759,-8.8649505743 26.4696679438,-4.4849313355 28.0967432950,-1.2307806330 M 27.7078544061,10.4358860336 M 15.1561302682,9.9665373746 M 14.9013409962,18.1063841179 M 36.3706896552,18.2807136198 M 36.8936781609,-5.6024281426 C 33.4651979566,-8.9727985130 25.8201381272,-17.8232892334 7.5660919540,-17.9664128169 T C -6.0665816801,-18.0733018367 -25.7802224737,-8.1303119556 -25.8649425287,15.3171120873 T C -25.9662062357,43.3432161542 -7.4812212724,55.3833038576 11.1465517241,55.1312883325 T C 21.4674950748,54.9916560770 28.7940613027,51.3183892265 31.9319923372,48.4128975279" />+		<path stroke="0" data="B 31.9319923372,48.4128975279 M 25.0159059474,40.9771784232 C 21.9619640387,44.0311203320 17.3500129553,44.6844586070 12.0366528354,45.0491009682 T C 5.7084597758,45.4833887272 -1.1037156620,43.3465201021 -6.4236121004,38.9482076969 C -12.0149318264,34.3254915975 -15.9578146611,27.2046854249 -15.9578146611,17.9453665284 T C -15.9578146611,3.0573997234 -5.0145228216,-8.0131396957 10.0006915629,-8.0131396957 T C 21.0843103019,-8.0131396957 23.9979253112,-3.9412171508 26.0338865837,-2.0325034578 M 26.0338865837,10.0560165975 M 15.1561302682,9.9665373746 M 14.9013409962,18.1063841179 M 35.9591977870,17.9453665284 M 35.9591977870,-5.9771784232 C 32.5307175827,-9.3475487936 28.2552988185,-17.9384508990 10.0006915629,-17.9384508990 T C -6.0325034578,-17.9384508990 -26.0103734440,-5.5022105690 -26.0103734440,17.9453665284 T C -26.0103734440,44.0311203320 -6.5928248447,54.9744121715 12.0366528354,54.9744121715 T C 21.9619640387,54.9744121715 28.7940613027,51.3183892265 31.9319923372,48.4128975279" /> 	</glyph> </collection> <collection unicode="U+68">@@ -143,7 +144,7 @@ </collection> <collection unicode="U+6b"> 	<selected id="1"/>-	<glyph id="1" left="-28" right="35">+	<glyph id="1" left="-28" right="40"> 		<path stroke="0" data="B -23.6793535471,-17.9662513661 C -23.7512661154,5.9319781421 -23.8231786837,29.8302076503 -23.8950912520,53.7284371585 M -14.3432661154,53.7645464481 M -14.5639695625,2.5424954392 M -14.6523371536,-17.9663335780 C -17.6613426181,-17.9663061740 -19.2378332796,-17.9724994699 -23.6793535471,-17.9662513661" /> 		<path stroke="0" data="B -14.6666666667,19.8938053097 M 14.0766961652,53.4277286136 M 25.8053097345,53.4277286136 M -4.2595870206,20.3893805310 M 31.4218289086,-17.9351032448 M 19.8584070796,-17.9351032448 M -15.1622418879,18.4070796460 M -14.6666666667,19.8938053097" /> 	</glyph>@@ -231,7 +232,7 @@ </collection> <collection unicode="U+74"> 	<selected id="1"/>-	<glyph id="1" left="-24" right="30">+	<glyph id="1" left="-24" right="54"> 		<path stroke="0" data="B 24.6295769464,45.1473907804 C 17.7492350661,45.1473907804 11.8232818645,45.1075219280 5.4201343235,45.0875875018 M 5.1699611888,-17.9745573770 M -4.4170491803,-18.0695081967 M -4.1851115782,45.2153939564 M -22.8085869880,45.1191316613 M -22.9335081967,53.8224262295 M 24.4453770492,53.8051147541 C 24.5067770149,50.9192067629 24.6495199664,49.7741714072 24.6295769464,45.1473907804" /> 	</glyph> </collection>@@ -267,16 +268,24 @@ </collection> <kerning left="e" right="l" hadjustment="-1.0000000000" /> <kerning left="t" right="a" hadjustment="17.0000000000" />+<kerning left="o" right="n" hadjustment="-5.0000000000" />+<kerning left="a" right="n" hadjustment="0.0000000000" /> <kerning left="l" right="o" hadjustment="-3.0000000000" /> <kerning left="n" right="d" hadjustment="1.0000000000" />-<kerning left="r" right="o" hadjustment="-12.0000000000" />-<kerning left="i" right="d" hadjustment="-9.0000000000" />+<kerning left="r" right="o" hadjustment="-9.6666666667" />+<kerning left="i" right="d" hadjustment="-4.6666666667" /> <kerning left="F" right="o" hadjustment="-3.0000000000" />+<kerning left="f" right="o" hadjustment="-5.3333333333" /> <kerning left="o" right="p" hadjustment="-5.0000000000" />+<kerning left="r" right="space" hadjustment="0.0000000000" />+<kerning left="d" right="f" hadjustment="3.3333333333" /> <kerning left="e" right="r" hadjustment="1.0000000000" />-<kerning left="o" right="r" hadjustment="-7.0000000000" />-<kerning left="d" right="r" hadjustment="-6.0000000000" />+<kerning left="o" right="r" hadjustment="-3.6666666667" />+<kerning left="d" right="r" hadjustment="-5.0000000000" />+<kerning left="i" right="r" hadjustment="-3.0000000000" /> <kerning left="r" right="t" hadjustment="-15.0000000000" />-<kerning left="o" right="i" hadjustment="-3.0000000000" />+<kerning left="o" right="i" hadjustment="1.3333333333" />+<kerning left="b" right="i" hadjustment="18.3333333333" />+<kerning left="n" right="t" hadjustment="0.3333333333" /> <kerning left="a" right="v" hadjustment="-13.0000000000" /> </font>diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex 578a565..1c7b330 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -779,7 +779,7 @@ public class DrawingTools : ToolCollection  { 		freehand_samples.set_min (0.002); 		 		if (BirdFont.android) {-			freehand_samples.set_value_round (2);+			freehand_samples.set_value_round (2.5); 		} else { 			freehand_samples.set_value_round (1); 		}diff --git a/libbirdfont/FileTab.vala b/libbirdfont/FileTab.valaindex be4b0da..45a035c 100644--- a/libbirdfont/FileTab.vala+++ b/libbirdfont/FileTab.vala@@ -1,5 +1,5 @@ /*-    Copyright (C) 2013 Johan Mattsson+    Copyright (C) 2013 2014 Johan Mattsson      This library is free software; you can redistribute it and/or modify      it under the terms of the GNU Lesser General Public License as @@ -20,15 +20,17 @@ public class FileTab : FontDisplay { 	 	int scroll = 0; 	int visible_rows = 0;-	double row_height = 30;-	double top = 60;+	double row_height;+	double top; 	WidgetAllocation allocation = new WidgetAllocation ();-	List<Font> recent_fonts = new List<Font> ();-	List<string> backups = new List<string> (); // FIXME: use ref counted object+	Gee.ArrayList<Font> recent_fonts = new Gee.ArrayList<Font> ();+	Gee.ArrayList<string> backups = new Gee.ArrayList<string> (); // FIXME: use ref counted object 	 	public signal void open_file (); 	 	public FileTab () {+		row_height = 30 * MainWindow.units;+		top = 2 * row_height; 	}  	public static void load_font (string fn) {@@ -85,7 +87,6 @@ public class FileTab : FontDisplay { 			 			MenuTab.save_callback = new SaveCallback (); 			MenuTab.save_callback.file_saved.connect (() => {-				print ("DISC:..\n"); 				dialog.signal_discard (); 			}); 			MenuTab.save_callback.save (); // background thread@@ -156,12 +157,7 @@ public class FileTab : FontDisplay { 			warning ("No recent fonts"); 			return; 		}--		if (is_null (recent_fonts.data)) {-			warning ("Recent font 1 has no data");-			return;-		}-		+				 		foreach (Font font in recent_fonts) { 			 			if (is_null (font)) {@@ -226,27 +222,27 @@ public class FileTab : FontDisplay { 		cr.fill (); 		cr.restore (); -		if (recent_fonts.length () == 0 && !has_backup ()) {+		if (recent_fonts.size == 0 && !has_backup ()) { 			cr.save (); 			cr.set_source_rgba (0.3, 0.3, 0.3, 1);-			cr.set_font_size (18);-			cr.move_to (50, top - 9);+			cr.set_font_size (18 * MainWindow.units);+			cr.move_to (50 * MainWindow.units, top - 9 * MainWindow.units); 			cr.show_text (t_("No fonts created yet.")); 			cr.restore (); 		} 		-		if (scroll == 0 && recent_fonts.length () > 0) {+		if (scroll == 0 && recent_fonts.size > 0) { 			cr.save (); 			cr.set_source_rgba (0.3, 0.3, 0.3, 1);-			cr.set_font_size (18);-			cr.move_to (50, top - 9);+			cr.set_font_size (18 * MainWindow.units);+			cr.move_to (50 * MainWindow.units, top - 9 * MainWindow.units); 			cr.show_text (t_("Recent files")); 			cr.restore (); 		} 		 		cr.save (); 		cr.set_source_rgba (0.3, 0.3, 0.3, 1);-		cr.set_font_size (12);+		cr.set_font_size (12 * MainWindow.units);  		foreach (Font font in recent_fonts) { 			if (s++ >= scroll) {@@ -262,8 +258,8 @@ public class FileTab : FontDisplay { 			if (s >= scroll) { 				cr.save (); 				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.set_font_size (18 * MainWindow.units);+				cr.move_to (50 * MainWindow.units, y + 2 * row_height - 9 * MainWindow.units); 				cr.show_text (t_("Backup")); 				cr.restore (); 				s += 2;@@ -288,24 +284,27 @@ public class FileTab : FontDisplay { 		fn = fn.substring (fn.replace ("\\", "/").last_index_of ("/") + 1); 		draw_background (cr, allocation, y, color); 		-		cr.move_to (50, y + row_height / 2 + 5);+		cr.move_to (50 * MainWindow.units, y + row_height / 2 + 5 * MainWindow.units); 		cr.show_text (fn); 	}  	private void draw_backup_row (WidgetAllocation allocation, Context cr, string backup, bool color, double y) { 		File thumbnail;+		double u = MainWindow.units;+		 		thumbnail = BirdFont.get_thumbnail_directory ().get_child (backup); 			 		draw_background (cr, allocation, y, color); 		-		cr.move_to (50, y + row_height / 2 + 5);+		cr.move_to (50 * u, y + row_height / 2 + 5 * u); 		cr.show_text (backup); 		-		cr.move_to (35 - 5, y + row_height / 2 + 12 - 14);-		cr.line_to (35 - 10, y + row_height / 2 + 12 - 9);+		// draw x+		cr.move_to ((35 - 5) * u, y + row_height / 2 + (12 - 14) * u);+		cr.line_to ((35 - 10) * u, y + row_height / 2 + (12 - 9) * u); -		cr.move_to (35 - 10, y + row_height / 2 + 12 - 14);-		cr.line_to (35 - 5, y + row_height / 2 + 12 - 9);+		cr.move_to ((35 - 10) * u, y + row_height / 2 + (12 - 14) * u);+		cr.line_to ((35 - 5) * u, y + row_height / 2 + (12 - 9) * u); 		 		cr.stroke (); 	}@@ -372,9 +371,7 @@ public class FileTab : FontDisplay { 		update_recent_files (); 		update_scrollbar (); 		-		while (backups.length () != 0) {-			backups.delete_link (backups.first ());-		}+		backups.clear (); 		 		backups = get_backups (); 		redraw_area (0, 0, allocation.width, allocation.height);@@ -404,7 +401,7 @@ public class FileTab : FontDisplay { 	}  	int rows () {-		int l = (int) (recent_fonts.length () + backups.length ());+		int l = (int) (recent_fonts.size + backups.size); 		 		if (has_backup ()) { 			l += 2;@@ -417,9 +414,7 @@ public class FileTab : FontDisplay { 	public void update_recent_files () { 		Font font; -		while (recent_fonts.length () != 0) {-			recent_fonts.delete_link (recent_fonts.first ());-		}+		recent_fonts.clear (); 		 		foreach (var f in Preferences.get_recent_files ()) { 			if (f == "") continue;@@ -431,15 +426,13 @@ public class FileTab : FontDisplay { 			font.set_font_file (f); 			 			if (file.query_exists ()) { -				recent_fonts.append (font);+				recent_fonts.insert (0, font); 			}-		}-		-		recent_fonts.reverse ();+		}		 	} 	 	bool has_backup () {-		return backups.length () > 0;+		return backups.size > 0; 	}  	public static void delete_backups () {@@ -461,11 +454,11 @@ public class FileTab : FontDisplay { 		} 	} -	public List<string> get_backups () {+	public Gee.ArrayList<string> get_backups () { 		FileEnumerator enumerator; 		string file_name; 		FileInfo? file_info;-		List<string> backups = new List<string> ();+		Gee.ArrayList<string> backups = new Gee.ArrayList<string> (); 		File dir = BirdFont.get_backup_directory (); 		Font font = BirdFont.get_current_font (); @@ -484,7 +477,7 @@ public class FileTab : FontDisplay { 					continue; 				} 				-				backups.append (file_name);+				backups.insert (0, file_name); 			} 		} catch (Error e) { 			warning (e.message);diff --git a/libbirdfont/PointConverter.vala b/libbirdfont/PointConverter.valaindex 6e6f2ce..aee92ff 100644--- a/libbirdfont/PointConverter.vala+++ b/libbirdfont/PointConverter.vala@@ -29,10 +29,10 @@ public class PointConverter {  	public Path get_quadratic_path () { 		int i;-		bool add_more_points;+		bool add_more_points = false; 		quadratic_path = original_path.copy (); 		-		for (i = 0; i < 5; i++) {+		for (i = 0; i < 20; i++) { 			add_more_points = get_estimated_cubic_path (); 			if (!add_more_points) { 				break;@@ -66,6 +66,7 @@ public class PointConverter { 		EditPoint new_start; 		EditPoint e; 		double distance, px, py;+		Gee.ArrayList<EditPoint> points_to_add = new Gee.ArrayList<EditPoint> (); 		 		if (quadratic_path.points.size <= 1) { 			return false;@@ -79,20 +80,15 @@ public class PointConverter { 			if (start.get_right_handle ().type == PointType.CUBIC || stop.get_left_handle ().type == PointType.CUBIC) { 				find_largest_distance (start, stop, start.copy (), stop.copy (), out distance, out px, out py); 				-				if (distance > 0.11) { // range 0.1 - 0.3, default 0.11+				if (distance > 0.14) { // range 0.1 - 0.3, default 0.11 					e = new EditPoint (); 					quadratic_path.get_closest_point_on_path (e, px, py); 					e.type = PointType.CUBIC; 					e.get_left_handle ().type = PointType.CUBIC; 					e.get_right_handle ().type = PointType.CUBIC;-					quadratic_path.insert_new_point_on_path (e);-					-					quadratic_path.create_list ();-					points_on_segment += 1;													-					return true;+					points_to_add.add (e); 				} 			}-			points_on_segment = 0; 			 			if (i == quadratic_path.points.size - 2) { 				start = stop;@@ -103,8 +99,14 @@ public class PointConverter { 				start = new_start; 			} 		}+		+		foreach (EditPoint ep in points_to_add) {+			quadratic_path.insert_new_point_on_path (ep);+		}+		+		quadratic_path.create_list (); 				-		return false;+		return points_to_add.size > 0; 	}  	// TODO: Optimize

Contact

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