Commit ee1c4cc
Editable .notdef character
Changed files (4)
modifiedlibbirdfont/OpenFontFormat/GlyfTable.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/OverViewItem.valamodifiedlibbirdfont/OverviewTools.vala
Diff
@@ -163,7 +163,7 @@ public class GlyfTable : OtfTable { g.remove_empty_paths (); unassigned = gc.is_unassigned (); - if (unassigned) {+ if (unassigned && gc.get_name () != ".notdef") { unassigned_glyphs.add (gc); } @@ -103,6 +103,13 @@ public class OverView : FontDisplay { set_initial_zoom (); PenTool.update_orientation (); }+ + if (glyph_collection.get_name () == ".notdef") {+ Font font = BirdFont.get_current_font ();+ if (!font.has_glyph (".notdef")) {+ font.add_glyph_collection (glyph_collection);+ }+ } }); this.open_new_glyph_signal.connect ((character) => {@@ -519,7 +526,7 @@ public class OverView : FontDisplay { public void process_item_list_update () { string character_string;- Font f = BirdFont.get_current_font ();+ Font font = BirdFont.get_current_font (); GlyphCollection? glyphs = null; uint32 index; OverViewItem item;@@ -543,10 +550,11 @@ public class OverView : FontDisplay { y = OverViewItem.margin; if (all_available) {- uint font_length = f.length ();+ uint font_length = font.length ();+ int i; - for (int i = 0; i < item_list_length && index < font_length; i++) {- glyphs = f.get_glyph_collection_index ((uint32) index);+ for (i = 0; i < item_list_length && index < font_length; i++) {+ glyphs = font.get_glyph_collection_index ((uint32) index); return_if_fail (glyphs != null); glyph = ((!) glyphs).get_current ();@@ -557,16 +565,20 @@ public class OverView : FontDisplay { item.set_character (character); item.set_glyphs (glyphs); item.generate_graphics ();- item.x = x;- item.y = y;- - if (glyphs != null) {- item.selected = (selected_items.index_of ((!) glyphs) != -1);- }+ item.selected = (selected_items.index_of ((!) glyphs) != -1); visible_items.add (item); index++; }+ + if (i < item_list_length && !font.has_glyph (".notdef")) {+ item = new OverViewItem ();+ item.set_glyphs (font.get_not_def_character ());+ item.generate_graphics (false);+ item.version_menu = null;+ item.selected = (selected_items.index_of ((!) glyphs) != -1);+ visible_items.add (item);+ } } else { uint32 glyph_range_size = glyph_range.get_length (); @@ -593,7 +605,7 @@ public class OverView : FontDisplay { visible_size = visible_items.size; for (int i = 0; i < visible_size; i++) { item = visible_items.get (i);- glyphs = f.get_glyph_collection_by_name ((!) item.character.to_string ());+ glyphs = font.get_glyph_collection_by_name ((!) item.character.to_string ()); item.set_glyphs (glyphs); if (glyphs != null) {@@ -669,9 +681,8 @@ public class OverView : FontDisplay { void draw_empty_canvas (WidgetAllocation allocation, Context cr) { Text t;- cr.save ();- t = new Text (t_("No glyphs in this view."), 24);+ t = new Text ("No glyphs in this view.", 24); Theme.text_color (t, "Text Foreground"); t.widget_x = 40; t.widget_y = 30;@@ -1315,7 +1326,8 @@ public class OverView : FontDisplay { if (is_null(i.version_menu)) { update = true; } else {- update = !i.version_menu.menu_visible;+ VersionList v = (!) i.version_menu;+ update = !v.menu_visible; } } index++;@@ -42,7 +42,7 @@ public class OverViewItem : GLib.Object { public static double glyph_scale = 1.0; - public VersionList version_menu;+ public VersionList? version_menu = null; Text label; private Surface? cache = null;@@ -63,19 +63,22 @@ public class OverViewItem : GLib.Object { glyphs = gc; } - public void generate_graphics () {- if (glyphs != null) { - version_menu = new VersionList ((!) glyphs);- version_menu.add_glyph_item.connect ((glyph) => {+ public void generate_graphics (bool generate_versions = true) {+ if (glyphs != null && generate_versions) {+ VersionList versions = new VersionList ((!) glyphs);+ + versions.add_glyph_item.connect ((glyph) => { ((!) glyphs).insert_glyph (glyph, true); }); - version_menu.signal_delete_item.connect ((glyph_index) => {+ versions.signal_delete_item.connect ((glyph_index) => { OverView v = MainWindow.get_overview (); version_menu = new VersionList ((!) glyphs); v.update_item_list (); GlyphCanvas.redraw (); });+ + version_menu = versions; } info = new CharacterInfo (character, glyphs);@@ -236,16 +239,17 @@ public class OverViewItem : GLib.Object { GlyphCollection g; bool s = (x <= px <= x + width) && (y <= py <= y + height); - if (has_icons () && glyphs != null) {+ if (has_icons () && glyphs != null && version_menu != null) { g = (!) glyphs;- version_menu.set_position (x + width - 21, y + height - 18);- a = version_menu.menu_item_action (px, py); // select one item on the menu+ VersionList versions = (!) version_menu;+ versions.set_position (x + width - 21, y + height - 18);+ a = versions.menu_item_action (px, py); // select one item on the menu if (a) { return s; } - version_menu.menu_icon_action (px, py); // click in the open menu+ versions.menu_icon_action (px, py); // click in the open menu } info.set_position (x + width - 17, y + height - 22.5);@@ -367,7 +371,10 @@ public class OverViewItem : GLib.Object { cc.fill (); if (has_icons ()) {- draw_menu_icon (cc, false);+ if (version_menu != null) { + draw_menu_icon (cc, false);+ }+ draw_character_info_icon (cc); } @@ -464,7 +471,8 @@ public class OverViewItem : GLib.Object { public void hide_menu () { if (!is_null (version_menu)) {- version_menu.menu_visible = false;+ VersionList v = (!) version_menu;+ v.menu_visible = false; } } @@ -484,11 +492,21 @@ public class OverViewItem : GLib.Object { } private void draw_menu (Context cr) {- if (glyphs == null || !version_menu.menu_visible) {+ if (glyphs == null) {+ return;+ }++ if (version_menu == null) {+ return;+ }+ + VersionList v = (!) version_menu;+ + if (!v.menu_visible) { return; } - version_menu.draw_menu (cr);+ v.draw_menu (cr); } } @@ -308,9 +308,16 @@ public class OverviewTools : ToolCollection { GlyphRange gr; uint size; OverView overview;-- // All characters- size = BirdFont.get_current_font ().length ();+ Font font;+ + // All characters including .notdef+ font = BirdFont.get_current_font ();+ size = font.length ();+ + if (!font.has_glyph (".notdef")) {+ size++;+ }+ all_glyphs.number = get_display_value (size); // Default