* grub-core/term/gfxterm.c (grub_virtual_screen_setup): Get font as

argument rather than font name. All users updated.
	(grub_gfxterm_set_window): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-12-10 16:07:33 +01:00
parent b9f5ebd65c
commit 969b804f2a
4 changed files with 28 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2012-12-10 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/gfxterm.c (grub_virtual_screen_setup): Get font as
argument rather than font name. All users updated.
(grub_gfxterm_set_window): Likewise.
2012-12-10 Vladimir Testov <vladimir.testov@rosalab.ru>
* util/grub-mkfont.c (argp_parser): Fix a typo which prevented --asce

View file

@ -361,6 +361,15 @@ grub_gfxmenu_draw_terminal_box (void)
static void
init_terminal (grub_gfxmenu_view_t view)
{
grub_font_t terminal_font;
terminal_font = grub_font_get (view->terminal_font_name);
if (!terminal_font)
{
grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
return;
}
term_rect.width = view->screen.width * 7 / 10;
term_rect.height = view->screen.height * 7 / 10;
@ -375,7 +384,7 @@ init_terminal (grub_gfxmenu_view_t view)
grub_gfxterm_set_window (GRUB_VIDEO_RENDER_TARGET_DISPLAY, term_rect.x,
term_rect.y,
term_rect.width, term_rect.height,
view->double_repaint, view->terminal_font_name, 3);
view->double_repaint, terminal_font, 3);
grub_gfxterm_decorator_hook = grub_gfxmenu_draw_terminal_box;
}

View file

@ -201,7 +201,7 @@ grub_virtual_screen_free (void)
static grub_err_t
grub_virtual_screen_setup (unsigned int x, unsigned int y,
unsigned int width, unsigned int height,
const char *font_name)
grub_font_t font)
{
unsigned int i;
@ -209,10 +209,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y,
grub_virtual_screen_free ();
/* Initialize with default data. */
virtual_screen.font = grub_font_get (font_name);
if (!virtual_screen.font)
return grub_error (GRUB_ERR_BAD_FONT,
"no font loaded");
virtual_screen.font = font;
virtual_screen.width = width;
virtual_screen.height = height;
virtual_screen.offset_x = x;
@ -282,7 +279,7 @@ grub_err_t
grub_gfxterm_set_window (struct grub_video_render_target *target,
int x, int y, int width, int height,
int double_repaint,
const char *font_name, int border_width)
grub_font_t font, int border_width)
{
/* Clean up any prior instance. */
destroy_window ();
@ -294,7 +291,7 @@ grub_gfxterm_set_window (struct grub_video_render_target *target,
if (grub_virtual_screen_setup (border_width, border_width,
width - 2 * border_width,
height - 2 * border_width,
font_name)
font)
!= GRUB_ERR_NONE)
{
return grub_errno;
@ -321,6 +318,7 @@ grub_gfxterm_fullscreen (void)
grub_video_color_t color;
grub_err_t err;
int double_redraw;
grub_font_t font;
err = grub_video_get_info (&mode_info);
/* Figure out what mode we ended up. */
@ -346,12 +344,16 @@ grub_gfxterm_fullscreen (void)
if (! font_name)
font_name = ""; /* Allow fallback to any font. */
font = grub_font_get (font_name);
if (!font)
return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
grub_gfxterm_decorator_hook = NULL;
return grub_gfxterm_set_window (GRUB_VIDEO_RENDER_TARGET_DISPLAY,
0, 0, mode_info.width, mode_info.height,
double_redraw,
font_name, DEFAULT_BORDER_WIDTH);
font, DEFAULT_BORDER_WIDTH);
}
static grub_err_t

View file

@ -23,12 +23,13 @@
#include <grub/types.h>
#include <grub/term.h>
#include <grub/video.h>
#include <grub/font.h>
grub_err_t
EXPORT_FUNC (grub_gfxterm_set_window) (struct grub_video_render_target *target,
int x, int y, int width, int height,
int double_repaint,
const char *font_name, int border_width);
grub_font_t font, int border_width);
typedef void (*grub_gfxterm_repaint_callback_t)(int x, int y,
int width, int height);