Date:2012-09-13 20:10:38 (11 years 6 months ago)
Author:Werner Almesberger
Commit:69db2f62c40645c523fc9bb35eb1ac9c796ead98
Message:libtxt/font.c: draw_char returns maximum character width for space

Files: tools/libtxt/font.c (3 diffs)

Change Details

tools/libtxt/font.c
4040struct font {
4141    struct image *img;
4242    struct sym sym[CHARS];
43    int max_width;
4344};
4445
4546
...... 
148149static void set_block(struct font *font, int *n,
149150    int xlast, int x, int y0, int y1)
150151{
152    int width = x-xlast-1;
153
154    if (width > font->max_width)
155        font->max_width = width;
151156    font->sym[*n].x = xlast+1;
152157    font->sym[*n].y = y0;
153    font->sym[*n].w = x-xlast-1;
158    font->sym[*n].w = width;
154159    font->sym[*n].h = y1-y0+1;
155160    (*n)++;
156161}
...... 
269274    const char *cp;
270275    const struct sym *sym;
271276
277    if (c == ' ')
278        return font->max_width;
272279    cp = strchr(charset, c);
273280    if (!cp)
274281        return 0;

Archive Download the corresponding diff file

Branches:
master
tornado-v1



interactive