Clone in a terminal:
Commit 2e76f50
Johan Mattsson - 2014-10-05T09:59:56+00:00
2e76f50d93ba924bb58961e8ed728b0c5909d6d4johan.mattsson.m@gmail.com

Ligature info in over view tab

Changed files (3)

Diff

diff --git a/libbirdfont/CharacterInfo.vala b/libbirdfont/CharacterInfo.valaindex ad4544d..705be0f 100644--- a/libbirdfont/CharacterInfo.vala+++ b/libbirdfont/CharacterInfo.vala@@ -23,13 +23,28 @@ public class CharacterInfo : GLib.Object { 	double x = 0; 	double y = 0; 	unichar unicode;+	bool ligature = false;+	string name = ""; 	-	public CharacterInfo (unichar c) {+	public CharacterInfo (unichar c, GlyphCollection? gc) { 		unicode = c; 		 		if (info_icon == null) { 			info_icon = Icons.get_icon ("info_icon.png"); 		}+		+		if (gc != null) {+			ligature = ((!) gc).is_unassigned ();+			name = ((!) gc).get_name ();+		}+	}+	+	public string get_name () {+		return name;+	}+	+	public bool is_ligature () {+		return ligature; 	} 	 	public string get_entry () {diff --git a/libbirdfont/OverView.vala b/libbirdfont/OverView.valaindex 834df02..c479f3a 100644--- a/libbirdfont/OverView.vala+++ b/libbirdfont/OverView.vala@@ -1048,6 +1048,7 @@ public class OverView : FontDisplay { 		int length = 0; 		bool see_also = false; 		WidgetAllocation allocation = MainWindow.get_overview ().allocation;+		string name; 		 		entry = ((!)character_info).get_entry (); 		@@ -1087,37 +1088,43 @@ public class OverView : FontDisplay { 		cr.restore ();  		// database entry-		i = 0;-		foreach (string line in entry.split ("\n")) {-			if (i == 0) {-				column = line.split ("\t");-				return_if_fail (column.length == 2);-				unicode_value = "U+" + column[0];-				unicode_description = column[1];+		+		if (((!)character_info).is_ligature ()) {+			name = ((!)character_info).get_name ();+			draw_info_line ("Ligature " + name, cr, x, y, 0);+		} else {+			i = 0;+			foreach (string line in entry.split ("\n")) {+				if (i == 0) {+					column = line.split ("\t");+					return_if_fail (column.length == 2);+					unicode_value = "U+" + column[0];+					unicode_description = column[1]; -				draw_info_line (unicode_description, cr, x, y, i);-				i++;+					draw_info_line (unicode_description, cr, x, y, i);+					i++; -				draw_info_line (unicode_value, cr, x, y, i);-				i++;			-			} else {-				-				if (line.has_prefix ("\t*")) {-					draw_info_line (line.replace ("\t*", "•"), cr, x, y, i);-					i++;					-				} else if (line.has_prefix ("\tx (")) {-					if (!see_also) {+					draw_info_line (unicode_value, cr, x, y, i);+					i++;			+				} else {+					+					if (line.has_prefix ("\t*")) {+						draw_info_line (line.replace ("\t*", "•"), cr, x, y, i);+						i++;					+					} else if (line.has_prefix ("\tx (")) {+						if (!see_also) {+							i++;+							draw_info_line (t_("See also:"), cr, x, y, i);+							i++;+							see_also = true;+						}+						+						draw_info_line (line.replace ("\tx (", "•").replace (")", ""), cr, x, y, i); 						i++;-						draw_info_line (t_("See also:"), cr, x, y, i);+					} else {+ 						i++;-						see_also = true; 					}-					-					draw_info_line (line.replace ("\tx (", "•").replace (")", ""), cr, x, y, i);-					i++;-				} else {--					i++; 				} 			} 		}diff --git a/libbirdfont/OverViewItem.vala b/libbirdfont/OverViewItem.valaindex 5a5b2f3..41f4671 100644--- a/libbirdfont/OverViewItem.vala+++ b/libbirdfont/OverViewItem.vala@@ -38,7 +38,7 @@ public class OverViewItem : GLib.Object { 		this.y = y; 		this.character = character; 		this.glyphs = glyphs;-		this.info = new CharacterInfo (character);+		this.info = new CharacterInfo (character, glyphs); 	} 	 	public string get_name () {

Contact

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