Changeset 883 for libcaca


Ignore:
Timestamp:
Apr 25, 2006, 8:16:42 PM (15 years ago)
Author:
Sam Hocevar
Message:
  • Really fixed bold in ANSI loader, and removed dead code.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/import.c

    r882 r883  
    200200unsigned char _get_ansi_command(unsigned char const *buffer, int size);
    201201int _parse_tuple(unsigned int *ret, unsigned char const *buffer, int size);
    202 void _manage_modifiers(int i, int *fg, int *bg, int *save_fg, int *save_bg);
     202void _manage_modifiers(int i, int *fg, int *bg, int *save_fg, int *save_bg, int *bold);
    203203
    204204static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
     
    213213    int save_x = 0, save_y = 0;
    214214    unsigned int j, add = 0;
    215     int fg, bg, save_fg, save_bg;
     215    int fg, bg, save_fg, save_bg, bold;
    216216
    217217    fg = save_fg = CUCUL_COLOR_LIGHTGRAY;
    218218    bg = save_bg = CUCUL_COLOR_BLACK;
     219    bold = 0;
    219220
    220221    cv = cucul_create_canvas(width, height);
     
    285286            case 'm':
    286287                for(j = 0; j < count; j++)
    287                     _manage_modifiers(tuple[j], &fg, &bg, &save_fg, &save_bg);
     288                    _manage_modifiers(tuple[j], &fg, &bg, &save_fg, &save_bg, &bold);
     289                if(bold && fg < 8)
     290                    fg += 8;
     291                if(bold && bg < 8)
     292                    bg += 8;
    288293                cucul_set_color(cv, fg, bg);
    289294                break;
     
    306311            else
    307312            {
    308                 if((buffer[i] >= 0x20) || (buffer[i] <= 0x7E))
    309                 {
    310                     _cucul_putchar32(cv, x, y,_cucul_cp437_to_utf32(buffer[i]));
    311 
    312                     //  cucul_putchar(cv, x, y, buffer[i]);
    313                 }
    314                 else
    315                     cucul_putchar(cv, x, y, '?');
     313                _cucul_putchar32(cv, x, y,_cucul_cp437_to_utf32(buffer[i]));
    316314                x++;
    317315            }
     
    391389
    392390
    393 void _manage_modifiers(int i, int *fg, int *bg, int *save_fg, int *save_bg)
     391void _manage_modifiers(int i, int *fg, int *bg, int *save_fg, int *save_bg, int *bold)
    394392{
    395393    static uint8_t const ansi2cucul[] =
     
    422420        *fg = CUCUL_COLOR_DEFAULT;
    423421        *bg = CUCUL_COLOR_DEFAULT;
     422        *bold = 0;
    424423        break;
    425424    case 1: /* BOLD */
    426         if(*fg < 8)
    427             *fg += 8;
    428         if(*bg < 8)
    429             *bg += 8;
     425        *bold = 1;
    430426        break;
    431427    case 4: // Underline
Note: See TracChangeset for help on using the changeset viewer.