@@ -60,7 +60,8 @@ enum eGlyphsortorder {
6060
6161EX eGlyphsortorder glyphsortorder;
6262EX string pinnedglyphs;
63- EX bool glyphpinned[int (ittypes) + int (motypes)];
63+ EX vector<int > revglyphpinned;
64+ EX unsigned glyphpinned[int (ittypes) + int (motypes)];
6465
6566int zero = 0 ;
6667
@@ -84,14 +85,19 @@ int glyphphase[glyphs];
8485int glyph_lastticks;
8586
8687EX void updateglyphpinned () {
87- for (int i=0 ; i<glyphs; i++) glyphpinned[i] = false ;
88+ revglyphpinned.clear ();
89+ for (int i=0 ; i<glyphs; i++) glyphpinned[i] = 0 ;
8890 if (!pinnedglyphs.empty ()) {
91+ unsigned n = 0 ;
8992 exp_parser ep;
9093 ep.s = pinnedglyphs;
9194 do {
9295 try {
9396 int i = ep.iparse ();
94- if (i >= 0 && i < glyphs) glyphpinned[i] = true ;
97+ if (i >= 0 && i < glyphs) {
98+ revglyphpinned.push_back (i);
99+ glyphpinned[i] = ++n;
100+ }
95101 }
96102 catch (hr_parse_exception&) {
97103 continue ;
@@ -102,8 +108,8 @@ EX void updateglyphpinned() {
102108
103109EX void updatepinnedglyphs () {
104110 std::stringstream ss;
105- for (int i= 0 ; i<glyphs; i++ ) {
106- if (glyphpinned[i]) ss << i << " ," ;
111+ for (auto & i: revglyphpinned ) {
112+ ss << i << " ," ;
107113 }
108114 pinnedglyphs = ss.str ();
109115 if (!pinnedglyphs.empty ()) pinnedglyphs.pop_back ();
@@ -153,7 +159,7 @@ int glyphcorner(int i) {
153159
154160bool glyphsort (int i, int j) {
155161 if (glyphpinned[i] != glyphpinned[j])
156- return glyphpinned[i] > glyphpinned[j];
162+ return glyphpinned[i] - 1 < glyphpinned[j] - 1 ; // We subtract 1 from both sides to make 0 wrap around, so that it compares greater than any positive value
157163 if (subclass (i) != subclass (j))
158164 return subclass (i) < subclass (j);
159165 if (glyphsortorder == gsoFirstTop)
0 commit comments