int smart_font_rep::resolve (string c) { if (math_kind != 0) { if (is_greek (c)) return sm->add_char (tuple ("italic-math"), c); if (is_special (c)) return sm->add_char (tuple ("special"), c); } array<string> a= trimmed_tokenize (family, ","); for (int attempt= 1; attempt <= 20; attempt++) { if (attempt > 1 && substitute_math_letter (c, math_kind) != "") break; for (int i= 0; i < N(a); i++) { int nr= resolve (c, a[i], attempt); if (nr >= 0) return nr; } } string sf= substitute_math_letter (c, math_kind); if (sf != "") return sm->add_char (tuple (sf), c); string virt= find_in_virtual (c); if (math_kind != 0 && !unicode_provides (c) && virt == "") return sm->add_char (tuple ("other"), c); if (virt != "") { //cout << "Found " << c << " in " << virt << "\n"; return sm->add_char (tuple ("virtual", virt), c); } return sm->add_char (tuple ("error"), c); }
void conv2latin(u8 *p, int n, int lang) { int c, gfx = 0, lat=0; if ((latin1 == KOI8) && lang==12) { /* russian */ while (n--) { c=*p; if(c==0x1b) lat = !lat; /* ESC switches languages inside page */ if ( is_koi(c)) { if (not gfx || (c & 0xa0) != 0x20) { if(!lat) conv2koi8(p); } } else if ((c & 0xe8) == 0) gfx = c & 0x10; p++; } } else if ((latin1 == GREEK) && lang==15) { /* Hellas */ while (n--) { c=*p; if(c==0x1b) lat = !lat; /* ESC switches languages inside page */ if ( is_greek(c)) { if (not gfx || (c & 0xa0) != 0x20) { if(!lat) conv2greek(p); } } else if ((c & 0xe8) == 0) gfx = c & 0x10; p++; } } else { while (n--) { if (lang_char[c = *p]) { if (not gfx || (c & 0xa0) != 0x20) *p = lang_chars[lang + 1][lang_char[c]]; } else if ((c & 0xe8) == 0) gfx = c & 0x10; p++; } } }