string uni_upcase_first (string s) { if (N(s) == 0) return s; int pos= 0; tm_char_forwards (s, pos); return uni_upcase_char (s (0, pos)) * s (pos, N(s)); }
string uni_upcase_all (string s) { string r; int i=0, n=N(s); while (i<n) { int start= i; tm_char_forwards (s, i); r << uni_upcase_char (s (start, i)); } return r; }
void poor_smallcaps_font_rep::advance (string s, int& pos, string& r, int& nr) { int start= pos; nr= -1; while (pos < N(s)) { int end= pos; tm_char_forwards (s, end); string c1= s (pos, end); string c2= uni_upcase_char (c1); int next= ((c1 != c2)? 1: 0); if (next == nr) pos= end; else if (nr == -1) { pos= end; nr= next; } else break; } r= s (start, pos); if (nr == 1) r= uni_upcase_all (r); }