Commit d948c95
Remove some code that needs speed optimization
Changed files (5)
modifiedlibbirdfont/Font.valamodifiedlibbirdfont/KerningClasses.valamodifiedlibbirdfont/OpenFontFormat/Cmap.valamodifiedlibbirdfont/OpenFontFormat/OpenFontFormatWriter.valamodifiedlibbirdfont/OverView.vala
Diff
@@ -355,12 +355,14 @@ public class Font : GLib.Object { } public string get_name_for_character (unichar c) {- // if some glyph is already mapped to unichar, return it's name+ // if a glyph already is mapped to a unichar, return it's name uint i = 0; Glyph? gl; Glyph g; StringBuilder sb; + // FIXME: this is too slow+ /* while ((gl = get_glyph_indice (i++)) != null) { g = (!) gl; @@ -368,6 +370,7 @@ public class Font : GLib.Object { return g.name; } }+ */ // otherwise return some default name, possibly from unicode database if (c == 0) {@@ -263,6 +263,7 @@ public class KerningClasses : GLib.Object { } public void all_pairs (KerningIterator kerningIterator) {+ // FIXME: THIS CODE IS TOO SLOW Font f = BirdFont.get_current_font (); Glyph? g1, g2; Glyph glyph1, glyph2;@@ -299,7 +299,7 @@ public class CmapSubtableWindowsUnicode : CmapSubtable { } fd.add_ushort (0); - // Fixa: implement rest of type 4 (mind gid_length in length field)+ // FIXME: implement the rest of type 4 (mind gid_length in length field) } } @@ -55,7 +55,7 @@ public class OpenFontFormatWriter : Object { dl = directory_table.get_font_file_size (); if (dl == 0) {- warning ("font is of zero size.");+ warning ("font size is zero"); return; } @@ -688,21 +688,28 @@ public class OverView : FontDisplay { // scroll to char if (all_available) {- for (r = 0; r < font.length (); r += items_per_row) {- for (i = 0; i < items_per_row; i++) {- glyphs = font.get_glyph_collection_indice ((uint32) r + i);- return_if_fail (glyphs != null);- glyph = ((!) glyphs).get_current ();+ + // don't search for glyphs in huge CJK fonts + if (font.length () > 300) {+ r = 0;+ } else {+ // FIXME: too slow+ for (r = 0; r < font.length (); r += items_per_row) {+ for (i = 0; i < items_per_row; i++) {+ glyphs = font.get_glyph_collection_indice ((uint32) r + i);+ return_if_fail (glyphs != null);+ glyph = ((!) glyphs).get_current ();+ + if (glyph.name == ch) {+ index = i;+ }+ } - if (glyph.name == ch) {- index = i;+ if (index > -1) {+ break; } }- - if (index > -1) {- break;- }- } + } } else { for (r = 0; r < gr.length (); r += items_per_row) { for (i = 0; i < items_per_row; i++) {