Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (revision 16022) +++ apps/gui/list.c (working copy) @@ -314,7 +314,7 @@ entry_name = P2STR(s); #ifdef HAVE_LCD_BITMAP - int style = STYLE_DEFAULT; + int style = STYLE_DEFAULT|STYLE_ALIGN_CENTER; /* position the string at the correct offset place */ int item_width,h; display->getstringsize(entry_name, &item_width, &h); Index: firmware/export/lcd.h =================================================================== --- firmware/export/lcd.h (revision 16022) +++ firmware/export/lcd.h (working copy) @@ -32,6 +32,7 @@ #ifdef HAVE_LCD_BITMAP int font; int drawmode; + int line_height; #endif int xmargin; /* During the transition only - to be removed */ int ymargin; /* During the transition only - to be removed */ @@ -52,7 +53,14 @@ #define STYLE_COLORBAR 0x40000000 #define STYLE_GRADIENT 0x80000000 #define STYLE_MODE_MASK 0xF0000000 + +#define STYLE_ALIGN_CENTER 0x0000000 +#define STYLE_ALIGN_TOP 0x0100000 +#define STYLE_ALIGN_BOTTOM 0x0200000 +#define STYLE_ALIGN_MASK 0x0300000 + #define STYLE_COLOR_MASK 0x0000FFFF + #ifdef HAVE_LCD_COLOR #define STYLE_CURLN_MASK 0x0000FF00 #define STYLE_MAXLN_MASK 0x000000FF Index: firmware/drivers/lcd-16bit.c =================================================================== --- firmware/drivers/lcd-16bit.c (revision 16022) +++ firmware/drivers/lcd-16bit.c (working copy) @@ -55,6 +55,7 @@ .y = 0, .width = LCD_WIDTH, .height = LCD_HEIGHT, + .line_height = 20, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, .xmargin = 0, @@ -903,7 +904,35 @@ while (dst < dst_end); } #endif /* !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR) */ - +static int viewport_line_height(void) +{ + struct font* pf = font_get(current_vp->font); + if (current_vp->line_height < pf->height) + return pf->height; + else + return current_vp->line_height; +} +static int line_number_to_pixel(int line, int style) +{ + struct font* pf = font_get(current_vp->font); + int h, ypos = 0, font_height = pf->height; + h = viewport_line_height(); + + switch (style&STYLE_ALIGN_MASK) + { + case STYLE_ALIGN_TOP: + ypos = current_vp->ymargin + line*h; + break; + case STYLE_ALIGN_CENTER: + ypos = current_vp->ymargin + (h-font_height)/2 + line*h; + break; + case STYLE_ALIGN_BOTTOM: + ypos = current_vp->ymargin + (h-font_height) + line*h; + break; + } + return ypos; +} + /* Draw a full native bitmap with a transparent color */ void lcd_bitmap_transparent(const fb_data *src, int x, int y, int width, int height) @@ -985,7 +1014,8 @@ lcd_getstringsize(str, &w, &h); xpos = current_vp->xmargin + x*w / utf8length(str); - ypos = current_vp->ymargin + y*h; + ypos = line_number_to_pixel(y, style); + current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; if (style & STYLE_COLORED) { @@ -997,6 +1027,7 @@ current_vp->drawmode ^= DRMODE_INVERSEVID; xrect = xpos + MAX(w - offset, 0); + h = viewport_line_height(); if (style & STYLE_GRADIENT) { current_vp->drawmode = DRMODE_FG; if (CURLN_UNPACK(style) == 0) @@ -1138,7 +1169,7 @@ pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = line_number_to_pixel(s->y, s->style); if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { @@ -1169,13 +1200,13 @@ /* Solid colour line selector */ current_vp->drawmode = DRMODE_FG; current_vp->fg_pattern = current_vp->lss_pattern; - lcd_fillrect(xpos, ypos, current_vp->width - xpos, pf->height); + lcd_fillrect(xpos, ypos, current_vp->width - xpos, viewport_line_height()); current_vp->fg_pattern = current_vp->lst_pattern; break; case STYLE_GRADIENT: /* Gradient line selector */ current_vp->drawmode = DRMODE_FG; - lcd_gradient_rect_scroll(xpos, current_vp->width, ypos, (signed)pf->height, + lcd_gradient_rect_scroll(xpos, current_vp->width, ypos, viewport_line_height(), NUMLN_UNPACK(s->style), CURLN_UNPACK(s->style)); current_vp->fg_pattern = current_vp->lst_pattern; @@ -1188,7 +1219,7 @@ current_vp->drawmode = lastmode; current_vp->fg_pattern = old_fgcolor; current_vp->bg_pattern = old_bgcolor; - lcd_update_viewport_rect(xpos, ypos, current_vp->width - xpos, pf->height); + lcd_update_viewport_rect(xpos, ypos, current_vp->width - xpos, viewport_line_height()); } lcd_set_viewport(old_vp);