The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

OverView.vala in libbirdfont

This file is a part of the Birdfont project.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git

Revisions

View the latest version of libbirdfont/OverView.vala.
Merge ../birdfont-2.x
1 /* 2 Copyright (C) 2012 - 2016 Johan Mattsson 3 4 This library is free software; you can redistribute it and/or modify 5 it under the terms of the GNU Lesser General Public License as 6 published by the Free Software Foundation; either version 3 of the 7 License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, but 10 WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 */ 14 15 using Cairo; 16 using SvgBird; 17 18 namespace BirdFont { 19 20 /** A display with all glyphs present in this font. */ 21 public class OverView : FontDisplay { 22 public WidgetAllocation allocation = new WidgetAllocation (); 23 24 public OverViewItem selected_item = new OverViewItem (); 25 26 public Gee.ArrayList<GlyphCollection> copied_glyphs = new Gee.ArrayList<GlyphCollection> (); 27 public Gee.ArrayList<GlyphCollection> selected_items = new Gee.ArrayList<GlyphCollection> (); 28 29 int selected = 0; 30 int first_visible = 0; 31 int rows = 0; 32 int items_per_row = 0; 33 34 double view_offset_y = 0; 35 double view_offset_x = 0; 36 37 public signal void open_new_glyph_signal (unichar c); 38 public signal void open_glyph_signal (GlyphCollection c); 39 40 public GlyphRange glyph_range { 41 get { 42 return _glyph_range; 43 } 44 45 set { 46 _glyph_range = value; 47 } 48 } 49 50 GlyphRange _glyph_range; 51 52 string search_query = ""; 53 54 public Gee.ArrayList<OverViewItem> visible_items = new Gee.ArrayList<OverViewItem> (); 55 56 /** List of undo commands. */ 57 public Gee.ArrayList<OverViewUndoItem> undo_items = new Gee.ArrayList<OverViewUndoItem> (); 58 public Gee.ArrayList<OverViewUndoItem> redo_items = new Gee.ArrayList<OverViewUndoItem> (); 59 60 /** Show all characters that has been drawn. */ 61 public bool all_available { 62 set { 63 _all_available = value; 64 update_item_list (); 65 } 66 67 get { 68 return _all_available; 69 } 70 } 71 72 bool _all_available = false; 73 74 /** Show unicode database info. */ 75 CharacterInfo? character_info = null; 76 77 double scroll_size = 1; 78 const double UCD_LINE_HEIGHT = 17 * 1.3; 79 80 private bool update_scheduled = true; 81 82 public OverView (GlyphRange? range = null, 83 bool open_selected = true, bool default_character_set = true) { 84 85 GlyphRange gr; 86 87 if (range == null) { 88 gr = new GlyphRange (); 89 set_current_glyph_range (gr); 90 } 91 92 if (open_selected) { 93 this.open_glyph_signal.connect ((glyph_collection) => { 94 TabBar tabs = MainWindow.get_tab_bar (); 95 string n = glyph_collection.get_current ().name; 96 bool selected = tabs.select_char (n); 97 98 GlyphTab glyph_tab; 99 100 if (!selected) { 101 glyph_tab = new GlyphTab (glyph_collection); 102 tabs.add_tab (glyph_tab, true, glyph_collection); 103 set_glyph_zoom (glyph_collection); 104 PenTool.update_orientation (); 105 } 106 107 if (glyph_collection.get_name () == ".notdef") { 108 Font font = BirdFont.get_current_font (); 109 if (!font.has_glyph (".notdef")) { 110 font.add_glyph_collection (glyph_collection); 111 } 112 } 113 }); 114 115 this.open_new_glyph_signal.connect ((character) => { 116 // ignore control characters 117 if (character <= 0x1F) { 118 return; 119 } 120 121 create_new_glyph (character); 122 }); 123 } 124 125 if (default_character_set) { 126 IdleSource idle = new IdleSource (); 127 128 idle.set_callback (() => { 129 use_default_character_set (); 130 selected_canvas (); 131 return false; 132 }); 133 134 idle.attach (null); 135 } 136 137 update_item_list (); 138 update_scrollbar (); 139 reset_zoom (); 140 } 141 142 public Glyph? get_selected_glyph () { 143 if (selected_items.size == 0) { 144 return null; 145 } 146 147 return selected_items.get (0).get_current (); 148 } 149 150 public void select_all_glyphs () { 151 Font f; 152 GlyphCollection? glyphs; 153 154 f = BirdFont.get_current_font (); 155 156 for (int index = 0; index < f.length (); index++) { 157 glyphs = f.get_glyph_collection_index ((uint32) index); 158 return_if_fail (glyphs != null); 159 160 selected_items.add ((!) glyphs); 161 } 162 163 foreach (OverViewItem item in visible_items) { 164 item.selected = item.glyphs != null; 165 } 166 167 GlyphCanvas.redraw (); 168 } 169 170 public void use_default_character_set () { 171 GlyphRange gr = new GlyphRange (); 172 all_available = false; 173 DefaultCharacterSet.use_default_range (gr); 174 set_current_glyph_range (gr); 175 OverviewTools.update_overview_characterset (); 176 FontDisplay.dirty_scrollbar = true; 177 } 178 179 public GlyphCollection create_new_glyph (unichar character) { 180 StringBuilder name = new StringBuilder (); 181 TabBar tabs = MainWindow.get_tab_bar (); 182 bool selected; 183 Glyph glyph; 184 GlyphCollection glyph_collection; 185 GlyphCanvas canvas; 186 GlyphTab glyph_tab; 187 188 glyph_collection = MainWindow.get_current_glyph_collection (); 189 name.append_unichar (character); 190 selected = tabs.select_char (name.str); 191 192 if (!selected) { 193 glyph_collection = add_character_to_font (character); 194 glyph_tab = new GlyphTab (glyph_collection); 195 glyph = glyph_collection.get_current (); 196 glyph.layers.add_layer (new Layer ()); 197 tabs.add_tab (glyph_tab, true, glyph_collection); 198 199 selected_items.add (glyph_collection); 200 201 canvas = MainWindow.get_glyph_canvas (); 202 canvas.set_current_glyph_collection (glyph_collection); 203 204 set_glyph_zoom (glyph_collection); 205 } else { 206 warning ("Glyph is already open"); 207 } 208 209 OverviewTools.update_overview_characterset (); 210 return glyph_collection; 211 } 212 213 public GlyphCollection add_empty_character_to_font (unichar character, bool unassigned, string name) { 214 return add_character_to_font (character, true, unassigned); 215 } 216 217 public GlyphCollection add_character_to_font (unichar character, bool empty = false, 218 bool unassigned = false, string glyph_name = "") { 219 StringBuilder name = new StringBuilder (); 220 Font font = BirdFont.get_current_font (); 221 GlyphCollection? fg; 222 Glyph glyph; 223 GlyphCollection glyph_collection; 224 225 if (glyph_name == "") { 226 name.append_unichar (character); 227 } else { 228 name.append (glyph_name); 229 } 230 231 if (all_available) { 232 fg = font.get_glyph_collection_by_name (name.str); 233 } else { 234 fg = font.get_glyph_collection (name.str); 235 } 236 237 if (fg != null) { 238 glyph_collection = (!) fg; 239 } else { 240 glyph_collection = new GlyphCollection (character, name.str); 241 242 if (!empty) { 243 glyph = new Glyph (name.str, !unassigned ? character : '\0'); 244 glyph_collection.add_master (new GlyphMaster ()); 245 glyph_collection.insert_glyph (glyph, true); 246 } 247 248 font.add_glyph_collection (glyph_collection); 249 } 250 251 glyph_collection.set_unassigned (unassigned); 252 253 return glyph_collection; 254 } 255 256 public static void search () { 257 OverView ow = MainWindow.get_overview (); 258 TextListener listener = new TextListener (t_("Search"), ow.search_query, t_("Filter")); 259 260 listener.signal_text_input.connect ((text) => { 261 OverView o = MainWindow.get_overview (); 262 o.search_query = text; 263 }); 264 265 listener.signal_submit.connect (() => { 266 OverView o = MainWindow.get_overview (); 267 string q = o.search_query; 268 269 if (q.char_count () > 1) { 270 q = q.down (); 271 } 272 273 GlyphRange r = CharDatabase.search (q); 274 o.set_current_glyph_range (r); 275 MainWindow.get_tab_bar ().select_tab_name ("Overview"); 276 277 TextListener tl = new TextListener (t_("Search"), o.search_query, t_("Filter")); 278 TabContent.show_text_input (tl); 279 }); 280 281 TabContent.show_text_input (listener); 282 } 283 284 public Glyph? get_current_glyph () { 285 OverViewItem oi = selected_item; 286 if (oi.glyphs != null) { 287 return ((!) oi.glyphs).get_current (); 288 } 289 return null; 290 } 291 292 public void set_glyph_zoom (GlyphCollection glyphs) { 293 GlyphCanvas canvas; 294 canvas = MainWindow.get_glyph_canvas (); 295 canvas.set_current_glyph_collection (glyphs); 296 Toolbox tools = MainWindow.get_toolbox (); 297 ZoomTool z = (ZoomTool) tools.get_tool ("zoom_tool"); 298 z.store_current_view (); 299 glyphs.get_current ().default_zoom (); 300 z.store_current_view (); 301 OverViewItem.reset_label (); 302 } 303 304 public double get_height () { 305 double l; 306 Font f; 307 308 if (rows == 0) { 309 return 0; 310 } 311 312 if (all_available) { 313 f = BirdFont.get_current_font (); 314 l = f.length (); 315 } else { 316 l = glyph_range.length (); 317 } 318 319 return 2.0 * OverViewItem.height * (l / rows); 320 } 321 322 public bool selected_char_is_visible () { 323 return first_visible <= selected <= first_visible + items_per_row * rows; 324 } 325 326 public override bool has_scrollbar () { 327 return true; 328 } 329 330 public bool all_characters_in_view () { 331 double length; 332 Font f; 333 334 if (all_available) { 335 f = BirdFont.get_current_font (); 336 length = f.length (); 337 } else { 338 length = glyph_range.length (); 339 } 340 341 return length < items_per_row * rows; 342 } 343 344 public void move_up () { 345 first_visible -= items_per_row; 346 selected += items_per_row; 347 348 if (first_visible < 0) { 349 selected -= items_per_row; 350 first_visible = 0; 351 view_offset_y = 0; 352 } 353 } 354 355 public void move_down () { 356 if (!at_bottom ()) { 357 first_visible += items_per_row; 358 selected -= items_per_row; 359 } 360 } 361 362 public override void scroll_wheel (double x, double y, double dx, double dy) { 363 double pixel_delta = 3 * dy; 364 365 if (dy > 0) { 366 view_offset_y += pixel_delta; 367 368 while (view_offset_y > 0) { 369 view_offset_y -= OverViewItem.height; 370 move_up (); 371 } 372 } else { 373 if (at_bottom ()) { 374 if (view_offset_y > -2 * OverViewItem.height && !all_characters_in_view ()) { 375 view_offset_y += pixel_delta; 376 } 377 } else { 378 view_offset_y += pixel_delta; 379 while (view_offset_y < -OverViewItem.height) { 380 view_offset_y += OverViewItem.height; 381 move_down (); 382 } 383 } 384 } 385 386 if (view_offset_y < -2 * OverViewItem.height) { 387 view_offset_y = -2 * OverViewItem.height; 388 } 389 390 update_item_list (); 391 update_scrollbar (); 392 hide_menu (); 393 GlyphCanvas.redraw (); 394 } 395 396 public override void selected_canvas () { 397 OverviewTools.update_overview_characterset (); 398 KeyBindings.set_require_modifier (true); 399 update_scrollbar (); 400 update_zoom_bar (); 401 update_item_list (); 402 selected_item = get_selected_item (); 403 GlyphCanvas.redraw (); 404 } 405 406 public void update_zoom_bar () { 407 double z = OverViewItem.width / OverViewItem.DEFAULT_WIDTH - 0.5; 408 Toolbox.overview_tools.zoom_bar.set_zoom (z); 409 Toolbox.redraw_tool_box (); 410 update_item_list (); 411 } 412 413 public void set_zoom (double zoom) { 414 double z = zoom + 0.5; 415 OverViewItem.glyph_scale = 1; 416 OverViewItem.width = OverViewItem.DEFAULT_WIDTH * z; 417 OverViewItem.height = OverViewItem.DEFAULT_HEIGHT * z; 418 OverViewItem.margin = OverViewItem.DEFAULT_MARGIN * z; 419 update_item_list (); 420 OverViewItem.reset_label (); 421 GlyphCanvas.redraw (); 422 } 423 424 public override void zoom_min () { 425 OverViewItem.width = OverViewItem.DEFAULT_WIDTH * 0.5; 426 OverViewItem.height = OverViewItem.DEFAULT_HEIGHT * 0.5; 427 OverViewItem.margin = OverViewItem.DEFAULT_MARGIN * 0.5; 428 update_item_list (); 429 OverViewItem.reset_label (); 430 GlyphCanvas.redraw (); 431 update_zoom_bar (); 432 } 433 434 public override void reset_zoom () { 435 OverViewItem.width = OverViewItem.DEFAULT_WIDTH; 436 OverViewItem.height = OverViewItem.DEFAULT_HEIGHT; 437 OverViewItem.margin = OverViewItem.DEFAULT_MARGIN; 438 update_item_list (); 439 OverViewItem.reset_label (); 440 GlyphCanvas.redraw (); 441 update_zoom_bar (); 442 } 443 444 public override void zoom_max () { 445 OverViewItem.width = allocation.width; 446 OverViewItem.height = allocation.height; 447 update_item_list (); 448 OverViewItem.reset_label (); 449 GlyphCanvas.redraw (); 450 } 451 452 public override void zoom_in () { 453 OverViewItem.width *= 1.1; 454 OverViewItem.height *= 1.1; 455 OverViewItem.margin *= 1.1; 456 update_item_list (); 457 OverViewItem.reset_label (); 458 GlyphCanvas.redraw (); 459 update_zoom_bar (); 460 } 461 462 public override void zoom_out () { 463 OverViewItem.width *= 0.9; 464 OverViewItem.height *= 0.9; 465 OverViewItem.margin *= 0.9; 466 update_item_list (); 467 OverViewItem.reset_label (); 468 GlyphCanvas.redraw (); 469 update_zoom_bar (); 470 } 471 472 public override void store_current_view () { 473 } 474 475 public override void restore_last_view () { 476 } 477 478 public override void next_view () { 479 } 480 481 public override string get_label () { 482 return t_("Overview"); 483 } 484 485 public override string get_name () { 486 return "Overview"; 487 } 488 489 public void display_all_available_glyphs () { 490 all_available = true; 491 492 view_offset_y = 0; 493 first_visible = 0; 494 selected = 0; 495 496 update_item_list (); 497 selected_item = get_selected_item (); 498 GlyphCanvas.redraw (); 499 } 500 501 OverViewItem get_selected_item () { 502 if (visible_items.size == 0) { 503 return new OverViewItem (); 504 } 505 506 if (!(0 <= selected < visible_items.size)) { 507 return selected_item; 508 } 509 510 OverViewItem item = visible_items.get (selected); 511 item.selected = true; 512 return item; 513 } 514 515 int get_items_per_row () { 516 int i = 1; 517 double tab_with = allocation.width - 30; // 30 px for the scroll bar 518 OverViewItem.margin = OverViewItem.width * 0.1; 519 double l = OverViewItem.margin + OverViewItem.full_width (); 520 521 while (l <= tab_with) { 522 l += OverViewItem.full_width (); 523 i++; 524 } 525 526 return i - 1; 527 } 528 529 public void update_item_list () { 530 update_scheduled = true; 531 } 532 533 public void process_item_list_update () { 534 string character_string; 535 Font font = BirdFont.get_current_font (); 536 GlyphCollection? glyphs = null; 537 uint32 index; 538 OverViewItem item; 539 double x, y; 540 unichar character; 541 Glyph glyph; 542 double tab_with; 543 int item_list_length; 544 int visible_size; 545 546 tab_with = allocation.width - 30; // scrollbar 547 548 items_per_row = get_items_per_row (); 549 rows = (int) (allocation.height / OverViewItem.full_height ()) + 2; 550 551 item_list_length = items_per_row * rows; 552 visible_items.clear (); 553 554 index = (uint32) first_visible; 555 x = OverViewItem.margin; 556 y = OverViewItem.margin; 557 558 if (all_available) { 559 uint font_length = font.length (); 560 int i; 561 562 for (i = 0; i < item_list_length && index < font_length; i++) { 563 glyphs = font.get_glyph_collection_index ((uint32) index); 564 return_if_fail (glyphs != null); 565 566 glyph = ((!) glyphs).get_current (); 567 character_string = glyph.name; 568 character = glyph.unichar_code; 569 570 item = new OverViewItem (); 571 item.set_character (character); 572 item.set_glyphs (glyphs); 573 item.generate_graphics (); 574 item.selected = (selected_items.index_of ((!) glyphs) != -1); 575 576 visible_items.add (item); 577 index++; 578 } 579 580 if (i < item_list_length && !font.has_glyph (".notdef")) { 581 item = new OverViewItem (); 582 item.set_glyphs (font.get_notdef_character ()); 583 item.generate_graphics (false); 584 item.version_menu = null; 585 item.selected = (selected_items.index_of ((!) glyphs) != -1); 586 visible_items.add (item); 587 } 588 } else { 589 uint32 glyph_range_size = glyph_range.get_length (); 590 591 uint max_length = glyph_range.length () - first_visible; 592 593 if (item_list_length > max_length) { 594 item_list_length = (int) max_length; 595 } 596 597 for (int i = 0; i < item_list_length && index < glyph_range_size; i++) { 598 item = new OverViewItem (); 599 visible_items.add (item); 600 } 601 602 index = (uint32) first_visible; 603 visible_size = visible_items.size; 604 for (int i = 0; i < visible_size; i++) { 605 item = visible_items.get (i); 606 character = glyph_range.get_character ((uint32) index); 607 item.set_character (character); 608 index++; 609 } 610 611 visible_size = visible_items.size; 612 for (int i = 0; i < visible_size; i++) { 613 item = visible_items.get (i); 614 glyphs = font.get_glyph_collection_by_name ((!) item.character.to_string ()); 615 item.set_glyphs (glyphs); 616 617 if (glyphs != null) { 618 item.selected = (selected_items.index_of ((!) glyphs) != -1); 619 } 620 } 621 622 for (int i = 0; i < visible_size; i++) { 623 item = visible_items.get (i); 624 item.generate_graphics (); 625 } 626 } 627 628 x = OverViewItem.margin; 629 y = OverViewItem.margin; 630 631 visible_size = visible_items.size; 632 double full_width = OverViewItem.full_width (); 633 634 for (int i = 0; i < visible_size; i++) { 635 item = visible_items.get (i); 636 637 if (all_available) { 638 glyphs = font.get_glyph_collection_index ((uint32) i); 639 } else { 640 glyphs = font.get_glyph_collection_by_name ((!) item.character.to_string ()); 641 } 642 643 if (glyphs != null) { 644 int selected_index = selected_items.index_of ((!) glyphs); 645 item.selected = (selected_index != -1); 646 } 647 648 item.adjust_scale (); 649 650 item.x = x + view_offset_x; 651 item.y = y + view_offset_y; 652 653 x += full_width; 654 655 if (x + full_width >= tab_with) { 656 x = OverViewItem.margin; 657 y += OverViewItem.full_height (); 658 } 659 } 660 661 get_selected_item ().selected = true; 662 update_scheduled = false; 663 } 664 665 public override void draw (WidgetAllocation allocation, Context cr) { 666 if (update_scheduled 667 || this.allocation.width != allocation.width 668 || this.allocation.height != allocation.height 669 || this.allocation.width == 0) { 670 this.allocation = allocation; 671 process_item_list_update (); 672 } 673 674 this.allocation = allocation; 675 676 // clear canvas 677 cr.save (); 678 Theme.color (cr, "Background 1"); 679 cr.rectangle (0, 0, allocation.width, allocation.height); 680 cr.fill (); 681 cr.restore (); 682 683 foreach (OverViewItem i in visible_items) { 684 i.draw (allocation, cr); 685 } 686 687 if (unlikely (visible_items.size == 0)) { 688 draw_empty_canvas (allocation, cr); 689 } 690 691 if (unlikely (character_info != null)) { 692 draw_character_info (cr); 693 } 694 } 695 696 void draw_empty_canvas (WidgetAllocation allocation, Context cr) { 697 Text t; 698 cr.save (); 699 t = new Text ("No glyphs in this view.", 24); 700 Theme.text_color (t, "Text Foreground"); 701 t.widget_x = 40; 702 t.widget_y = 30; 703 t.draw (cr); 704 cr.restore (); 705 } 706 707 public void scroll_rows (int row_adjustment) { 708 for (int i = 0; i < row_adjustment; i++) { 709 scroll (-OverViewItem.height); 710 } 711 712 for (int i = 0; i > row_adjustment; i--) { 713 scroll (OverViewItem.height); 714 } 715 } 716 717 public void scroll_adjustment (double pixel_adjustment) { 718 double l; 719 Font f; 720 721 if (all_available) { 722 f = BirdFont.get_current_font (); 723 l = f.length (); 724 } else { 725 l = glyph_range.length (); 726 } 727 728 if (first_visible <= 0) { 729 return; 730 } 731 732 if (first_visible + rows * items_per_row >= l) { 733 return; 734 } 735 736 scroll ((int64) pixel_adjustment); 737 } 738 739 void scroll_to_position (int64 r) { 740 if (r < 0) { 741 scroll_top (); 742 return; 743 } 744 745 selected -= (int) (r - first_visible); 746 first_visible = (int) r; 747 update_item_list (); 748 } 749 750 public override void scroll_to (double position) requires (items_per_row > 0) { 751 double r; 752 int nrows; 753 Font f; 754 755 if (all_available) { 756 f = BirdFont.get_current_font (); 757 nrows = (int) (f.length () / items_per_row); 758 } else { 759 nrows = (int) (glyph_range.length () / items_per_row); 760 } 761 762 view_offset_y = 0; 763 r = (int64) (position * (nrows - rows + 3)); // 3 invisible rows 764 r *= items_per_row; 765 766 scroll_to_position ((int64) r); 767 update_item_list (); 768 GlyphCanvas.redraw (); 769 } 770 771 private void scroll (double pixel_adjustment) { 772 if (first_visible < 0 && pixel_adjustment < 0) { 773 scroll_top (); 774 return; 775 } 776 777 view_offset_y += pixel_adjustment; 778 779 if (view_offset_y >= 0) { 780 while (view_offset_y > OverViewItem.height) { 781 view_offset_y -= OverViewItem.height; 782 first_visible -= items_per_row; 783 } 784 785 first_visible -= items_per_row; 786 view_offset_y -= OverViewItem.height; 787 } else if (view_offset_y < -OverViewItem.height) { 788 view_offset_y = 0; 789 first_visible += items_per_row; 790 } 791 792 update_item_list (); 793 } 794 795 public void scroll_top () { 796 first_visible = 0; 797 view_offset_y = 0; 798 799 update_item_list (); 800 801 if (visible_items.size != 0) { 802 selected_item = get_selected_item (); 803 } 804 } 805 806 /** Returns true if the selected glyph is at the last row. */ 807 private bool last_row () { 808 return visible_items.size - selected <= items_per_row; 809 } 810 811 public void key_down () { 812 Font f = BirdFont.get_current_font (); 813 int64 len = (all_available) ? f.length () : glyph_range.length (); 814 815 if (at_bottom () && last_row ()) { 816 return; 817 } 818 819 selected += items_per_row; 820 821 if (selected >= items_per_row * rows) { 822 first_visible += items_per_row; 823 selected -= items_per_row; 824 } 825 826 if (first_visible + selected >= len) { 827 selected = (int) (len - first_visible - 1); 828 829 if (selected < items_per_row * (rows - 1)) { 830 first_visible -= items_per_row; 831 selected += items_per_row; 832 } 833 } 834 835 if (selected >= visible_items.size) { 836 selected = (int) (visible_items.size - 1); 837 } 838 839 selected_item = get_selected_item (); 840 update_item_list (); 841 } 842 843 public void key_right () { 844 Font f = BirdFont.get_current_font (); 845 int64 len = (all_available) ? f.length () : glyph_range.length (); 846 847 if (at_bottom () && first_visible + selected + 1 >= len) { 848 selected = (int) (visible_items.size - 1); 849 selected_item = get_selected_item (); 850 return; 851 } 852 853 selected += 1; 854 855 if (selected >= items_per_row * rows) { 856 first_visible += items_per_row; 857 selected -= items_per_row; 858 selected -= 1; 859 } 860 861 if (first_visible + selected > len) { 862 first_visible -= items_per_row; 863 selected = (int) (len - first_visible - 1); 864 selected_item = get_selected_item (); 865 } 866 update_item_list (); 867 } 868 869 public void key_up () { 870 selected -= items_per_row; 871 872 if (selected < 0) { 873 first_visible -= items_per_row; 874 selected += items_per_row; 875 } 876 877 if (first_visible < 0) { 878 first_visible = 0; 879 } 880 update_item_list (); 881 } 882 883 public void key_left () { 884 selected -= 1; 885 886 if (selected < 0) { 887 first_visible -= items_per_row; 888 selected += items_per_row; 889 selected += 1; 890 } 891 892 if (first_visible < 0) { 893 scroll_top (); 894 } 895 update_item_list (); 896 } 897 898 public string get_selected_char () { 899 Font f; 900 Glyph? g; 901 902 if (all_available) { 903 f = BirdFont.get_current_font (); 904 g = f.get_glyph_index (selected); 905 return_val_if_fail (g != null, "".dup ()); 906 return ((!) g).get_name (); 907 } 908 909 return glyph_range.get_char (selected); 910 } 911 912 public override void key_press (uint keyval) { 913 hide_menu (); 914 update_item_list (); 915 GlyphCanvas.redraw (); 916 917 if (KeyBindings.has_ctrl () || KeyBindings.has_logo ()) { 918 return; 919 } 920 921 switch (keyval) { 922 case Key.ENTER: 923 open_current_glyph (); 924 return; 925 926 case Key.UP: 927 get_selected_item ().selected = false; 928 929 key_up (); 930 selected_item = get_selected_item (); 931 932 selected_items.clear (); 933 if (selected_item.glyphs != null) { 934 selected_items.add ((!) selected_item.glyphs); 935 } 936 937 update_scrollbar (); 938 return; 939 940 case Key.RIGHT: 941 get_selected_item ().selected = false; 942 943 key_right (); 944 selected_item = get_selected_item (); 945 946 selected_items.clear (); 947 if (selected_item.glyphs != null) { 948 selected_items.add ((!) selected_item.glyphs); 949 } 950 951 update_scrollbar (); 952 return; 953 954 case Key.LEFT: 955 get_selected_item ().selected = false; 956 957 key_left (); 958 selected_item = get_selected_item (); 959 960 selected_items.clear (); 961 if (selected_item.glyphs != null) { 962 selected_items.add ((!) selected_item.glyphs); 963 } 964 965 update_scrollbar(); 966 return; 967 968 case Key.DOWN: 969 get_selected_item ().selected = false; 970 971 key_down (); 972 selected_item = get_selected_item (); 973 974 selected_items.clear (); 975 if (selected_item.glyphs != null) { 976 selected_items.add ((!) selected_item.glyphs); 977 } 978 979 update_scrollbar (); 980 return; 981 982 case Key.PG_UP: 983 get_selected_item ().selected = false; 984 985 for (int i = 0; i < rows; i++) { 986 key_up (); 987 } 988 selected_item = get_selected_item (); 989 990 selected_items.clear (); 991 if (selected_item.glyphs != null) { 992 selected_items.add ((!) selected_item.glyphs); 993 } 994 995 update_scrollbar (); 996 return; 997 998 case Key.PG_DOWN: 999 get_selected_item ().selected = false; 1000 1001 for (int i = 0; i < rows; i++) { 1002 key_down (); 1003 } 1004 selected_item = get_selected_item (); 1005 1006 selected_items.clear (); 1007 if (selected_item.glyphs != null) { 1008 selected_items.add ((!) selected_item.glyphs); 1009 } 1010 1011 update_scrollbar (); 1012 return; 1013 1014 case Key.DEL: 1015 delete_selected_glyph (); 1016 selected_item = get_selected_item (); 1017 return; 1018 1019 case Key.BACK_SPACE: 1020 delete_selected_glyph (); 1021 selected_item = get_selected_item (); 1022 return; 1023 } 1024 1025 if (!KeyBindings.has_ctrl () && !KeyBindings.has_logo ()) { 1026 scroll_to_char (keyval); 1027 } 1028 1029 selected_item = get_selected_item (); 1030 1031 selected_items.clear (); 1032 if (selected_item.glyphs != null) { 1033 selected_items.add ((!) selected_item.glyphs); 1034 } 1035 1036 update_item_list (); 1037 GlyphCanvas.redraw (); 1038 } 1039 1040 public void delete_selected_glyph () { 1041 Font font = BirdFont.get_current_font (); 1042 OverViewUndoItem undo_item = new OverViewUndoItem (); 1043 1044 undo_item.alternate_sets = font.alternates.copy (); 1045 1046 foreach (GlyphCollection g in selected_items) { 1047 undo_item.glyphs.add (g.copy ()); 1048 } 1049 store_undo_items (undo_item); 1050 1051 foreach (GlyphCollection glyph_collection in selected_items) { 1052 font.delete_glyph (glyph_collection); 1053 string name = glyph_collection.get_name (); 1054 MainWindow.get_tab_bar ().close_background_tab_by_name (name); 1055 } 1056 1057 update_item_list (); 1058 GlyphCanvas.redraw (); 1059 } 1060 1061 public override void undo () { 1062 Font font = BirdFont.get_current_font (); 1063 OverViewUndoItem previous_collection; 1064 1065 if (undo_items.size == 0) { 1066 return; 1067 } 1068 1069 previous_collection = undo_items.get (undo_items.size - 1); 1070 redo_items.add (get_current_state (previous_collection)); 1071 1072 // remove the old glyph and add the new one 1073 foreach (GlyphCollection g in previous_collection.glyphs) { 1074 font.delete_glyph (g); 1075 1076 if (g.length () > 0) { 1077 font.add_glyph_collection (g); 1078 } 1079 1080 TabBar tabs = MainWindow.get_tab_bar (); 1081 Tab? tab = tabs.get_tab (g.get_name ()); 1082 1083 if (tab != null) { 1084 Tab t = (!) tab; 1085 set_glyph_zoom (g); 1086 t.set_glyph_collection (g); 1087 t.set_display (new GlyphTab (g)); 1088 } 1089 } 1090 1091 Font f = BirdFont.get_current_font (); 1092 f.alternates = previous_collection.alternate_sets.copy (); 1093 1094 undo_items.remove_at (undo_items.size - 1); 1095 GlyphCanvas.redraw (); 1096 } 1097 1098 public override void redo () { 1099 Font font = BirdFont.get_current_font (); 1100 OverViewUndoItem previous_collection; 1101 1102 if (redo_items.size == 0) { 1103 return; 1104 } 1105 1106 previous_collection = redo_items.get (redo_items.size - 1); 1107 undo_items.add (get_current_state (previous_collection)); 1108 1109 // remove the old glyph and add the new one 1110 foreach (GlyphCollection g in previous_collection.glyphs) { 1111 font.delete_glyph (g); 1112 font.add_glyph_collection (g); 1113 1114 TabBar tabs = MainWindow.get_tab_bar (); 1115 Tab? tab = tabs.get_tab (g.get_name ()); 1116 1117 if (tab != null) { 1118 Tab t = (!) tab; 1119 set_glyph_zoom (g); 1120 t.set_glyph_collection (g); 1121 t.set_display (new GlyphTab (g)); 1122 } 1123 } 1124 font.alternates = previous_collection.alternate_sets.copy (); 1125 1126 redo_items.remove_at (redo_items.size - 1); 1127 GlyphCanvas.redraw (); 1128 } 1129 1130 public OverViewUndoItem get_current_state (OverViewUndoItem previous_collection) { 1131 GlyphCollection? gc; 1132 OverViewUndoItem ui = new OverViewUndoItem (); 1133 Font font = BirdFont.get_current_font (); 1134 1135 ui.alternate_sets = font.alternates.copy (); 1136 1137 foreach (GlyphCollection g in previous_collection.glyphs) { 1138 gc = font.get_glyph_collection (g.get_name ()); 1139 1140 if (gc != null) { 1141 ui.glyphs.add (((!) gc).copy ()); 1142 } else { 1143 ui.glyphs.add (new GlyphCollection (g.get_unicode_character (), g.get_name ())); 1144 } 1145 } 1146 1147 return ui; 1148 } 1149 1150 public void store_undo_state (GlyphCollection gc) { 1151 OverViewUndoItem i = new OverViewUndoItem (); 1152 Font f = BirdFont.get_current_font (); 1153 i.alternate_sets = f.alternates.copy (); 1154 i.glyphs.add (gc); 1155 store_undo_items (i); 1156 } 1157 1158 public void store_undo_items (OverViewUndoItem i) { 1159 undo_items.add (i); 1160 redo_items.clear (); 1161 } 1162 1163 bool select_visible_glyph (string name) { 1164 int i = 0; 1165 1166 foreach (OverViewItem o in visible_items) { 1167 if (o.get_name () == name) { 1168 selected = i; 1169 selected_item = get_selected_item (); 1170 1171 if (selected_item.y > allocation.height - OverViewItem.height) { 1172 view_offset_y -= (selected_item.y + OverViewItem.height) - allocation.height; 1173 } 1174 1175 if (selected_item.y < 0) { 1176 view_offset_y = 0; 1177 } 1178 1179 return true; 1180 } 1181 1182 if (i > 1000) { 1183 warning ("selected character not found"); 1184 return true; 1185 } 1186 1187 i++; 1188 } 1189 1190 return false; 1191 } 1192 1193 public void scroll_to_char (unichar c) { 1194 StringBuilder s = new StringBuilder (); 1195 1196 if (is_modifier_key (c)) { 1197 return; 1198 } 1199 1200 s.append_unichar (c); 1201 scroll_to_glyph (s.str); 1202 } 1203 1204 public void scroll_to_glyph (string name) { 1205 GlyphRange gr = glyph_range; 1206 int i, r, index; 1207 string ch; 1208 Font font = BirdFont.get_current_font (); 1209 GlyphCollection? glyphs = null; 1210 Glyph glyph; 1211 1212 index = -1; 1213 1214 if (items_per_row <= 0) { 1215 return; 1216 } 1217 1218 ch = name; 1219 1220 // selected char is visible 1221 if (select_visible_glyph (ch)) { 1222 return; 1223 } 1224 1225 // scroll to char 1226 if (all_available) { 1227 1228 // don't search for glyphs in huge CJK fonts 1229 if (font.length () > 500) { 1230 r = 0; 1231 } else { 1232 // FIXME: too slow 1233 for (r = 0; r < font.length (); r += items_per_row) { 1234 for (i = 0; i < items_per_row && i < font.length (); i++) { 1235 glyphs = font.get_glyph_collection_index ((uint32) r + i); 1236 return_if_fail (glyphs != null); 1237 glyph = ((!) glyphs).get_current (); 1238 1239 if (glyph.name == ch) { 1240 index = i; 1241 } 1242 } 1243 1244 if (index > -1) { 1245 break; 1246 } 1247 } 1248 } 1249 } else { 1250 1251 if (ch.char_count () > 1) { 1252 warning ("Can't scroll to ligature in this view"); 1253 return; 1254 } 1255 1256 for (r = 0; r < gr.length (); r += items_per_row) { 1257 for (i = 0; i < items_per_row; i++) { 1258 if (gr.get_char (r + i) == ch) { 1259 index = i; 1260 } 1261 } 1262 1263 if (index > -1) { 1264 break; 1265 } 1266 } 1267 } 1268 1269 if (index > -1) { 1270 first_visible = r; 1271 process_item_list_update (); 1272 update_item_list (); 1273 select_visible_glyph (ch); 1274 } 1275 } 1276 1277 public override void double_click (uint button, double ex, double ey) 1278 requires (!is_null (visible_items) && !is_null (allocation)) { 1279 1280 return_if_fail (!is_null (this)); 1281 1282 foreach (OverViewItem i in visible_items) { 1283 if (i.double_click (button, ex, ey)) { 1284 open_overview_item (i); 1285 } 1286 } 1287 1288 GlyphCanvas.redraw (); 1289 } 1290 1291 public void open_overview_item (OverViewItem i) { 1292 if (i.glyphs != null) { 1293 open_glyph_signal ((!) i.glyphs); 1294 ((!) i.glyphs).get_current ().close_path (); 1295 } else { 1296 open_new_glyph_signal (i.character); 1297 } 1298 } 1299 1300 public void set_character_info (CharacterInfo i) { 1301 character_info = i; 1302 } 1303 1304 public int get_selected_index () { 1305 GlyphCollection gc; 1306 int index = 0; 1307 1308 if (selected_items.size == 0) { 1309 return 0; 1310 } 1311 1312 gc = selected_items.get (0); 1313 1314 foreach (OverViewItem i in visible_items) { 1315 if (i.glyphs != null && gc == ((!) i.glyphs)) { 1316 break; 1317 } 1318 1319 index++; 1320 } 1321 1322 return index; 1323 } 1324 1325 public void hide_menu () { 1326 foreach (OverViewItem i in visible_items) { 1327 i.hide_menu (); 1328 } 1329 } 1330 1331 public override void button_press (uint button, double x, double y) { 1332 OverViewItem selected_item; 1333 int index = 0; 1334 int selected_index = -1; 1335 bool update = false; 1336 1337 if (character_info != null) { 1338 character_info = null; 1339 GlyphCanvas.redraw (); 1340 return; 1341 } 1342 1343 if (!KeyBindings.has_shift ()) { 1344 selected_items.clear (); 1345 } 1346 1347 for (int j = 0; j < visible_items.size; j++) { 1348 selected_item = visible_items.get (j); 1349 1350 if (selected_item.click (button, x, y)) { 1351 selected = index; 1352 selected_item = get_selected_item (); 1353 1354 if (KeyBindings.has_shift ()) { 1355 if (selected_item.glyphs != null) { 1356 selected_index = selected_items.index_of ((!) selected_item.glyphs); 1357 if (selected_index == -1) { 1358 selected_items.add ((!) selected_item.glyphs); 1359 } else { 1360 return_if_fail (0 <= selected_index < selected_items.size); 1361 selected_items.remove_at (selected_index); 1362 selected = get_selected_index (); 1363 selected_item = get_selected_item (); 1364 } 1365 } 1366 1367 update = true; 1368 } else { 1369 selected_items.clear (); 1370 if (selected_item.glyphs != null) { 1371 selected_items.add ((!) selected_item.glyphs); 1372 } 1373 } 1374 1375 if (!is_null (selected_item.version_menu)) { 1376 update = !((!) selected_item.version_menu).menu_visible; 1377 } else { 1378 update = true; 1379 } 1380 } 1381 index++; 1382 } 1383 1384 if (update) { 1385 update_item_list (); 1386 } 1387 1388 GlyphCanvas.redraw (); 1389 } 1390 1391 /** Returns true if overview shows the last character. */ 1392 private bool at_bottom () { 1393 Font f; 1394 double t = rows * items_per_row + first_visible; 1395 1396 if (all_available) { 1397 f = BirdFont.get_current_font (); 1398 return t >= f.length (); 1399 } 1400 1401 return t >= glyph_range.length (); 1402 } 1403 1404 public void set_current_glyph_range (GlyphRange range) { 1405 GlyphRange? current = glyph_range; 1406 string c; 1407 1408 if (current != null) { 1409 c = glyph_range.get_char (selected); 1410 } 1411 1412 all_available = false; 1413 1414 glyph_range = range; 1415 scroll_top (); 1416 1417 // TODO: scroll down to c 1418 update_item_list (); 1419 selected_item = get_selected_item (); 1420 1421 GlyphCanvas.redraw (); 1422 } 1423 1424 public void select_next_glyph () { 1425 key_right (); 1426 } 1427 1428 public void open_current_glyph () { 1429 open_overview_item (selected_item); 1430 } 1431 1432 public override void update_scrollbar () { 1433 Font f; 1434 double nrows = 0; 1435 double pos = 0; 1436 double size; 1437 double visible_rows; 1438 1439 if (rows == 0) { 1440 MainWindow.set_scrollbar_size (0); 1441 MainWindow.set_scrollbar_position (0); 1442 } else { 1443 if (all_available) { 1444 f = BirdFont.get_current_font (); 1445 nrows = Math.floor ((f.length ()) / rows); 1446 size = f.length (); 1447 } else { 1448 nrows = Math.floor ((glyph_range.length ()) / rows); 1449 size = glyph_range.length (); 1450 } 1451 1452 if (nrows <= 0) { 1453 nrows = 1; 1454 } 1455 1456 visible_rows = allocation.height / OverViewItem.height; 1457 scroll_size = visible_rows / nrows; 1458 MainWindow.set_scrollbar_size (scroll_size); 1459 pos = first_visible / (nrows * items_per_row - visible_rows * items_per_row); 1460 MainWindow.set_scrollbar_position (pos); 1461 } 1462 } 1463 1464 /** Display one entry from the Unicode Character Database. */ 1465 void draw_character_info (Context cr) 1466 requires (character_info != null) { 1467 double x, y, w, h; 1468 int i; 1469 string unicode_value, unicode_description; 1470 string[] column; 1471 string entry; 1472 int len = 0; 1473 int length = 0; 1474 bool see_also = false; 1475 WidgetAllocation allocation = MainWindow.get_overview ().allocation; 1476 string name; 1477 string[] lines; 1478 double character_start; 1479 double character_height; 1480 1481 entry = ((!)character_info).get_entry (); 1482 lines = entry.split ("\n"); 1483 1484 foreach (string line in entry.split ("\n")) { 1485 len = line.char_count (); 1486 if (len > length) { 1487 length = len; 1488 } 1489 } 1490 1491 x = allocation.width * 0.1; 1492 y = allocation.height * 0.1; 1493 w = allocation.width * 0.9 - x; 1494 h = allocation.height * 0.9 - y; 1495 1496 if (w < 8 * length) { 1497 w = 8 * length; 1498 x = (allocation.width - w) / 2.0; 1499 } 1500 1501 if (x < 0) { 1502 x = 2; 1503 } 1504 1505 // background 1506 cr.save (); 1507 Theme.color_opacity (cr, "Background 1", 0.98); 1508 cr.rectangle (x, y, w, h); 1509 cr.fill (); 1510 cr.restore (); 1511 1512 cr.save (); 1513 Theme.color_opacity (cr, "Foreground 1", 0.98); 1514 cr.set_line_width (2); 1515 cr.rectangle (x, y, w, h); 1516 cr.stroke (); 1517 cr.restore (); 1518 1519 // database entry 1520 1521 if (((!)character_info).is_ligature ()) { 1522 name = ((!)character_info).get_name (); 1523 draw_info_line (name, cr, x, y, 0); 1524 } else { 1525 i = 0; 1526 foreach (string line in lines) { 1527 if (i == 0) { 1528 column = line.split ("\t"); 1529 return_if_fail (column.length == 2); 1530 unicode_value = "U+" + column[0]; 1531 unicode_description = column[1]; 1532 1533 draw_info_line (unicode_description, cr, x, y, i); 1534 i++; 1535 1536 draw_info_line (unicode_value, cr, x, y, i); 1537 i++; 1538 } else { 1539 1540 if (line.has_prefix ("\t*")) { 1541 draw_info_line (line.replace ("\t*", "•"), cr, x, y, i); 1542 i++; 1543 } else if (line.has_prefix ("\tx (")) { 1544 if (!see_also) { 1545 i++; 1546 draw_info_line (t_("See also:"), cr, x, y, i); 1547 i++; 1548 see_also = true; 1549 } 1550 1551 draw_info_line (line.replace ("\tx (", "•").replace (")", ""), cr, x, y, i); 1552 i++; 1553 } else { 1554 i++; 1555 } 1556 } 1557 } 1558 1559 character_start = y + 10 + i * UCD_LINE_HEIGHT; 1560 character_height = h - character_start; 1561 draw_fallback_character (cr, x, character_start, character_height); 1562 } 1563 } 1564 1565 /** Fallback character in UCD info. */ 1566 void draw_fallback_character (Context cr, double x, double y, double height) 1567 requires (character_info != null) { 1568 unichar c = ((!)character_info).unicode; 1569 1570 cr.save (); 1571 Text character = new Text (); 1572 character.set_use_cache (false); 1573 Theme.text_color (character, "Foreground 1"); 1574 character.set_text ((!) c.to_string ()); 1575 character.set_font_size (height); 1576 character.draw_at_top (cr, x + 10, y); 1577 cr.restore (); 1578 } 1579 1580 void draw_info_line (string line, Context cr, double x, double y, int row) { 1581 Text ucd_entry = new Text (line); 1582 cr.save (); 1583 Theme.text_color (ucd_entry, "Foreground 1"); 1584 ucd_entry.widget_x = 10 + x; 1585 ucd_entry.widget_y = 10 + y + row * UCD_LINE_HEIGHT; 1586 ucd_entry.draw (cr); 1587 cr.restore (); 1588 } 1589 1590 public void paste () { 1591 GlyphCollection gc; 1592 GlyphCollection? c; 1593 Glyph glyph; 1594 uint32 index; 1595 int i; 1596 int skip = 0; 1597 int s; 1598 string character_string; 1599 Gee.ArrayList<GlyphCollection> glyps; 1600 Font f; 1601 OverViewUndoItem undo_item; 1602 1603 f = BirdFont.get_current_font (); 1604 gc = new GlyphCollection ('\0', ""); 1605 glyps = new Gee.ArrayList<GlyphCollection> (); 1606 1607 copied_glyphs.sort ((a, b) => { 1608 return (int) ((GlyphCollection) a).get_unicode_character () 1609 - (int) ((GlyphCollection) b).get_unicode_character (); 1610 }); 1611 1612 index = (uint32) first_visible + selected; 1613 for (i = 0; i < copied_glyphs.size; i++) { 1614 if (all_available) { 1615 if (f.length () == 0) { 1616 c = add_empty_character_to_font (copied_glyphs.get (i).get_unicode_character (), 1617 copied_glyphs.get (i).is_unassigned (), 1618 copied_glyphs.get (i).get_name ()); 1619 } else if (index >= f.length ()) { 1620 // FIXME: duplicated unicodes? 1621 c = add_empty_character_to_font (copied_glyphs.get (i).get_unicode_character (), 1622 copied_glyphs.get (i).is_unassigned (), 1623 copied_glyphs.get (i).get_name ()); 1624 } else { 1625 c = f.get_glyph_collection_index ((uint32) index); 1626 } 1627 1628 if (c == null) { 1629 c = add_empty_character_to_font (copied_glyphs.get (i).get_unicode_character (), 1630 copied_glyphs.get (i).is_unassigned (), 1631 copied_glyphs.get (i).get_name ()); 1632 } 1633 1634 return_if_fail (c != null); 1635 gc = (!) c; 1636 } else { 1637 if (i != 0) { 1638 s = (int) copied_glyphs.get (i).get_unicode_character (); 1639 s -= (int) copied_glyphs.get (i - 1).get_unicode_character (); 1640 s -= 1; 1641 skip += s; 1642 } 1643 1644 character_string = glyph_range.get_char ((uint32) (index + skip)); 1645 c = f.get_glyph_collection_by_name (character_string); 1646 1647 if (c == null) { 1648 gc = add_empty_character_to_font (character_string.get_char (), 1649 copied_glyphs.get (i).is_unassigned (), 1650 copied_glyphs.get (i).get_name ()); 1651 } else { 1652 gc = (!) c; 1653 } 1654 } 1655 1656 glyps.add (gc); 1657 index++; 1658 } 1659 1660 undo_item = new OverViewUndoItem (); 1661 undo_item.alternate_sets = f.alternates.copy (); 1662 foreach (GlyphCollection g in glyps) { 1663 undo_item.glyphs.add (g.copy ()); 1664 } 1665 store_undo_items (undo_item); 1666 1667 if (glyps.size != copied_glyphs.size) { 1668 warning ("glyps.size != copied_glyphs.size"); 1669 return; 1670 } 1671 1672 if (copied_glyphs.size < i) { 1673 warning ("Array index out of bounds."); 1674 return; 1675 } 1676 1677 i = 0; 1678 foreach (GlyphCollection g in glyps) { 1679 glyph = copied_glyphs.get (i).get_current ().copy (); 1680 glyph.version_id = (glyph.version_id == -1 || g.length () == 0) ? 1 : g.get_last_id () + 1; 1681 glyph.unichar_code = g.get_unicode_character (); 1682 1683 if (!g.is_unassigned ()) { 1684 glyph.name = (!) glyph.unichar_code.to_string (); 1685 } else { 1686 glyph.name = g.get_name (); 1687 } 1688 1689 g.insert_glyph (glyph, true); 1690 i++; 1691 } 1692 1693 f.touch (); 1694 } 1695 1696 public class OverViewUndoItem { 1697 public AlternateSets alternate_sets = new AlternateSets (); 1698 public Gee.ArrayList<GlyphCollection> glyphs = new Gee.ArrayList<GlyphCollection> (); 1699 } 1700 } 1701 1702 } 1703