Mercurial > otakunoraifu
comparison font/text_stream.cc @ 65:4416cfac86ae
Convert EUC-JP files to UTF8
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Fri, 26 Nov 2010 10:53:15 +0100 |
parents | ddbcbd000206 |
children |
comparison
equal
deleted
inserted
replaced
64:045ca45f9610 | 65:4416cfac86ae |
---|---|
221 | 221 |
222 void TextStream::RemoveName(char* name, int namelen) { | 222 void TextStream::RemoveName(char* name, int namelen) { |
223 Iterator it; | 223 Iterator it; |
224 for (it = container.begin(); it != container.end(); it++) { | 224 for (it = container.begin(); it != container.end(); it++) { |
225 if (it->type == TextElem::escape && it->impl.Escape.type == TextElem::name_start) { | 225 if (it->type == TextElem::escape && it->impl.Escape.type == TextElem::name_start) { |
226 // 行頭の名前? | 226 // 茵鐚 |
227 int pt = it - container.begin(); | 227 int pt = it - container.begin(); |
228 Iterator name_start = it; | 228 Iterator name_start = it; |
229 for (; it != container.end(); it++) { | 229 for (; it != container.end(); it++) { |
230 if (it->type == TextElem::escape && it->impl.Escape.type == TextElem::name_end) break; | 230 if (it->type == TextElem::escape && it->impl.Escape.type == TextElem::name_end) break; |
231 } | 231 } |
232 if (it != container.end()) { | 232 if (it != container.end()) { |
233 // 名前が見つかったので削除 | 233 // 荀ゃcу |
234 if (name) { // 保存先があるなら保存する | 234 if (name) { // 篆絖篆絖 |
235 Iterator name_end = it; | 235 Iterator name_end = it; |
236 int pos = 0; | 236 int pos = 0; |
237 namelen--; | 237 namelen--; |
238 for (it=name_start; it != name_end; it++) { | 238 for (it=name_start; it != name_end; it++) { |
239 if (it->type == TextElem::glyph) { | 239 if (it->type == TextElem::glyph) { |
245 if (pos < namelen) name[pos++] = code; | 245 if (pos < namelen) name[pos++] = code; |
246 } | 246 } |
247 } | 247 } |
248 } | 248 } |
249 name[pos] = 0; | 249 name[pos] = 0; |
250 name = 0; // 最初に出た名前のみ保存する | 250 name = 0; // 冴推絖 |
251 } | 251 } |
252 it++; | 252 it++; |
253 container.erase(name_start, it); | 253 container.erase(name_start, it); |
254 it = container.begin() + pt; | 254 it = container.begin() + pt; |
255 } | 255 } |
339 if (code < 0x30 || (code > 0x39 && code < 0x40)) { | 339 if (code < 0x30 || (code > 0x39 && code < 0x40)) { |
340 *buf++ = '='; | 340 *buf++ = '='; |
341 *buf++ = (code/0x10) + 'A'; | 341 *buf++ = (code/0x10) + 'A'; |
342 *buf++ = (code%0x10) + 'A'; | 342 *buf++ = (code%0x10) + 'A'; |
343 } else { | 343 } else { |
344 code = codeconv_euc_to_sjis(code); // save file の漢字コードはSJIS | 344 code = codeconv_euc_to_sjis(code); // save file 羲√潟若SJIS |
345 *buf++ = code/256; | 345 *buf++ = code/256; |
346 *buf++ = code%256; | 346 *buf++ = code%256; |
347 } | 347 } |
348 break; | 348 break; |
349 } | 349 } |