Changeset 1219 for libcaca/trunk
- Timestamp:
- Oct 22, 2006, 6:49:54 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cucul/import.c
r1171 r1219 247 247 cucul_canvas_t *cv; 248 248 unsigned int i, j, skip, dummy = 0; 249 unsigned int width = 1, height = 1 ;249 unsigned int width = 1, height = 1, wch = 1; 250 250 unsigned long int ch; 251 251 int x = 0, y = 0, save_x = 0, save_y = 0; … … 403 403 } 404 404 405 /* We're going to paste a character. First make sure the canvas 406 * is big enough. */ 407 if((unsigned int)x >= width) 405 /* Get the character we’re going to paste */ 406 if(utf8) 407 { 408 unsigned int bytes; 409 ch = cucul_utf8_to_utf32((char const *)(buffer + i), &bytes); 410 wch = cucul_utf32_is_fullwidth(ch) ? 2 : 1; 411 skip += bytes - 1; 412 } 413 else 414 { 415 ch = cucul_cp437_to_utf32(buffer[i]); 416 } 417 418 /* Make sure the canvas is big enough. */ 419 if((unsigned int)x + wch > width) 408 420 { 409 421 cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT); 410 cucul_set_canvas_size(cv, width = x + 1, height);422 cucul_set_canvas_size(cv, width = x + wch, height); 411 423 } 412 424 … … 418 430 419 431 /* Now paste our character */ 420 if(utf8)421 {422 unsigned int bytes;423 ch = cucul_utf8_to_utf32((char const *)(buffer + i), &bytes);424 skip += bytes - 1;425 }426 else427 {428 ch = cucul_cp437_to_utf32(buffer[i]);429 }430 432 cucul_set_color(cv, grcm.efg, grcm.ebg); 431 433 cucul_putchar(cv, x, y, ch); 432 x ++;434 x += wch; 433 435 } 434 436
Note: See TracChangeset
for help on using the changeset viewer.