Index: font/font.c =================================================================== --- font/font.c (revision 36621) +++ font/font.c (revision 36622) @@ -438,7 +438,7 @@ { long i, n, m, h; rnd_glyph_t *g; - rnd_coord_t *px, *py; + rnd_coord_t *px, *py, fminy, fmaxy; rnd_coord_t totalminy = RND_MAX_COORD; rnd_box_t b; @@ -447,6 +447,8 @@ minimum x and y position of all lines */ f->max_width = RND_FONT_DEFAULT_CELLSIZE; f->max_height = RND_FONT_DEFAULT_CELLSIZE; + fminy = fmaxy = 0; + for(i = 0, g = f->glyph; i <= RND_FONT_MAX_GLYPHS; i++, g++) { rnd_coord_t minx, miny, maxx, maxy; @@ -516,12 +518,20 @@ g->width = maxx - minx + 1; g->height = maxy + 1; + /* check total min/max */ + fminy = MIN(fminy, miny); + fmaxy = MAX(fmaxy, miny); + + /* check per glyph min/max */ f->max_width = MAX(f->max_width, g->width); f->max_height = MAX(f->max_height, g->height); + totalminy = MIN(totalminy, miny); } + f->height = fmaxy - fminy; + /* move coordinate system to the upper edge (lowest y on screen) */ if (totalminy != 0) { for(i = 0, g = f->glyph; i <= RND_FONT_MAX_GLYPHS; i++, g++) { Index: font/font.h =================================================================== --- font/font.h (revision 36621) +++ font/font.h (revision 36622) @@ -43,7 +43,8 @@ typedef long int rnd_font_id_t; /* safe reference */ typedef struct rnd_font_s { /* complete set of symbols */ - rnd_coord_t max_height, max_width; /* maximum glyph width and height */ + rnd_coord_t max_height, max_width; /* maximum glyph width and height; calculated per glyph */ + rnd_coord_t height; /* total height, font-wise (distance between lowest point of the lowest glyph and highest point of the tallest glyph) */ rnd_box_t unknown_glyph; /* drawn when a glyph is not found (filled box) */ rnd_glyph_t glyph[RND_FONT_MAX_GLYPHS+1]; char *name; /* not unique */