The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Ligature info in over view tab

These changes was commited to the Birdfont repository Sat, 04 Oct 2014 11:54:18 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 04 Oct 2014 11:54:18 +0000 (13:54 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sun, 05 Oct 2014 09:59:56 +0000 (11:59 +0200)
commit 2e76f50d93ba924bb58961e8ed728b0c5909d6d4
tree 4fce4bf8fd0f351e61abea9fb7414b49e68bdb35
parent b4f104118041d4131a91be5c5689e8ff06752cbb
Ligature info in over view tab

libbirdfont/CharacterInfo.vala
libbirdfont/OverView.vala
libbirdfont/OverViewItem.vala
--- a/libbirdfont/CharacterInfo.vala +++ b/libbirdfont/CharacterInfo.vala @@ -23,13 +23,28 @@ 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 () {
--- a/libbirdfont/OverView.vala +++ b/libbirdfont/OverView.vala @@ -1048,6 +1048,7 @@ int length = 0; bool see_also = false; WidgetAllocation allocation = MainWindow.get_overview ().allocation; + string name; entry = ((!)character_info).get_entry (); @@ -1087,37 +1088,43 @@ 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++; } } }
--- a/libbirdfont/OverViewItem.vala +++ b/libbirdfont/OverViewItem.vala @@ -38,7 +38,7 @@ this.y = y; this.character = character; this.glyphs = glyphs; - this.info = new CharacterInfo (character); + this.info = new CharacterInfo (character, glyphs); } public string get_name () {