* grub-core/gfxmenu/gui_label.c (label_paint): Handle the case

text_width > available width a bit more gracefully.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-15 19:35:54 +01:00
parent 384ad7cc1b
commit c476e6df16
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2011-12-15 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/gfxmenu/gui_label.c (label_paint): Handle the case
text_width > available width a bit more gracefully.
2011-12-15 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/bsdXX.c (grub_freebsd_load_elfmodule): Fix

View File

@ -94,15 +94,17 @@ label_paint (void *vself, const grub_video_rect_t *region)
if (self->align == align_left)
left_x = 0;
else if (self->align == align_center)
left_x = ((self->bounds.width
- grub_font_get_string_width (self->font, self->text))
) / 2;
left_x = (self->bounds.width
- grub_font_get_string_width (self->font, self->text)) / 2;
else if (self->align == align_right)
left_x = (self->bounds.width
- grub_font_get_string_width (self->font, self->text));
else
return; /* Invalid alignment. */
if (left_x < 0 || left_x > (int) self->bounds.width)
left_x = 0;
grub_video_rect_t vpsave;
grub_gui_set_viewport (&self->bounds, &vpsave);
grub_font_draw_string (self->text,