Commit 2e76f50
Ligature info in over view tab
Changed files (3)
modifiedlibbirdfont/CharacterInfo.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/OverViewItem.vala
Diff
@@ -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 () {@@ -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++; } } }@@ -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 () {