Ignore:
Timestamp:
Sep 26, 2006, 11:58:26 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • Crop the final canvas to the effective width.
  • Fixed a bug that prevented loading characters after 127.
  • Allow to load fonts that hex-encode their Unicode values.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • toilet/trunk/src/figlet.c

    r1106 r1113  
    6969    }
    7070
     71    cucul_set_canvas_boundaries(cv, 0, 0, x, font->height);
     72
    7173    free_font(font);
    7274
     
    135137        {
    136138            static int const tab[7] = { 196, 214, 220, 228, 246, 252, 223 };
    137             font->lookup[font->glyphs * 2] = tab[font->glyphs = (127 - 32)];
     139            font->lookup[font->glyphs * 2] = tab[font->glyphs + (127 - 32)];
    138140        }
    139141        else
    140142        {
    141             fscanf(f, "%u %*[^\n]", &font->lookup[font->glyphs * 2]);
     143            char number[10];
     144
     145            fscanf(f, "%s %*[^\n]", number);
     146
     147            if(number[1] == 'x')
     148                sscanf(number, "%x", &font->lookup[font->glyphs * 2]);
     149            else
     150                sscanf(number, "%u", &font->lookup[font->glyphs * 2]);
     151
    142152            fscanf(f, "%*c");
    143153        }
     
    174184
    175185            if(ch == font->hardblank)
    176                 cucul_putchar(font->image, i, j, ' ');
    177             else if(oldch && ch != oldch)
     186                cucul_putchar(font->image, i, j, ch = ' ');
     187
     188            if(oldch && ch != oldch)
    178189            {
    179190                if(!font->lookup[j / font->height * 2 + 1])
Note: See TracChangeset for help on using the changeset viewer.