const char *fl_font_change_attrib(const char *name, int word, const char *replace) { int att = font_word_pos(name, word); if(att==-1) return strdup(name); att++; int att_end = font_word_pos(name, word+1); if(att_end==-1) att_end = strlen(name); int len = att_end-att; Fl_String newname; newname.append(name, att); newname.append(replace, strlen(replace)); newname.append(name+att+len, strlen(name)-att_end); return strdup(newname.c_str()); }
Fl_String Fl_String::from_codeset(int conv_index, const char *str, int str_len) { if(str_len<=0) str_len = strlen(str); int outsize = str_len*3; char *outbuf = (char*)malloc(outsize); int len = fl_convert2utf(conv_index, (const uchar*)str, str_len, outbuf, outsize); Fl_String ret; if(len>0) ret.append(outbuf, len); //else ret.append(str, str_len); free(outbuf); return ret; }