a5bd9f6
From c54df09cdb44ab19f9f7d5ece0f6568f4c19e46f Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Mon, 10 Dec 2012 16:07:33 +0100
a5bd9f6
Subject: [PATCH 061/364] 	* grub-core/term/gfxterm.c
a5bd9f6
 (grub_virtual_screen_setup): Get font as 	argument rather than font
a5bd9f6
 name. All users updated. 	(grub_gfxterm_set_window): Likewise.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog                |  6 ++++++
a5bd9f6
 grub-core/gfxmenu/view.c | 11 ++++++++++-
a5bd9f6
 grub-core/term/gfxterm.c | 18 ++++++++++--------
a5bd9f6
 include/grub/gfxterm.h   |  3 ++-
a5bd9f6
 4 files changed, 28 insertions(+), 10 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 4204678..7617678 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,3 +1,9 @@
a5bd9f6
+2012-12-10  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
+	* grub-core/term/gfxterm.c (grub_virtual_screen_setup): Get font as
a5bd9f6
+	argument rather than font name. All users updated.
a5bd9f6
+	(grub_gfxterm_set_window): Likewise.
a5bd9f6
+
a5bd9f6
 2012-12-10  Vladimir Testov  <vladimir.testov@rosalab.ru>
a5bd9f6
 
a5bd9f6
 	* util/grub-mkfont.c (argp_parser): Fix a typo which prevented --asce
a5bd9f6
diff --git a/grub-core/gfxmenu/view.c b/grub-core/gfxmenu/view.c
a5bd9f6
index 9023fd3..c005773 100644
a5bd9f6
--- a/grub-core/gfxmenu/view.c
a5bd9f6
+++ b/grub-core/gfxmenu/view.c
a5bd9f6
@@ -361,6 +361,15 @@ grub_gfxmenu_draw_terminal_box (void)
a5bd9f6
 static void
a5bd9f6
 init_terminal (grub_gfxmenu_view_t view)
a5bd9f6
 {
a5bd9f6
+  grub_font_t terminal_font;
a5bd9f6
+
a5bd9f6
+  terminal_font = grub_font_get (view->terminal_font_name);
a5bd9f6
+  if (!terminal_font)
a5bd9f6
+    {
a5bd9f6
+      grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
a5bd9f6
+      return;
a5bd9f6
+    }
a5bd9f6
+
a5bd9f6
   term_rect.width = view->screen.width * 7 / 10;
a5bd9f6
   term_rect.height = view->screen.height * 7 / 10;
a5bd9f6
 
a5bd9f6
@@ -375,7 +384,7 @@ init_terminal (grub_gfxmenu_view_t view)
a5bd9f6
   grub_gfxterm_set_window (GRUB_VIDEO_RENDER_TARGET_DISPLAY, term_rect.x,
a5bd9f6
 			   term_rect.y,
a5bd9f6
 			   term_rect.width, term_rect.height,
a5bd9f6
-			   view->double_repaint, view->terminal_font_name, 3);
a5bd9f6
+			   view->double_repaint, terminal_font, 3);
a5bd9f6
   grub_gfxterm_decorator_hook = grub_gfxmenu_draw_terminal_box;
a5bd9f6
 }
a5bd9f6
 
a5bd9f6
diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c
a5bd9f6
index c995b84..12567d1 100644
a5bd9f6
--- a/grub-core/term/gfxterm.c
a5bd9f6
+++ b/grub-core/term/gfxterm.c
a5bd9f6
@@ -201,7 +201,7 @@ grub_virtual_screen_free (void)
a5bd9f6
 static grub_err_t
a5bd9f6
 grub_virtual_screen_setup (unsigned int x, unsigned int y,
a5bd9f6
                            unsigned int width, unsigned int height,
a5bd9f6
-                           const char *font_name)
a5bd9f6
+			   grub_font_t font)
a5bd9f6
 {
a5bd9f6
   unsigned int i;
a5bd9f6
 
a5bd9f6
@@ -209,10 +209,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y,
a5bd9f6
   grub_virtual_screen_free ();
a5bd9f6
 
a5bd9f6
   /* Initialize with default data.  */
a5bd9f6
-  virtual_screen.font = grub_font_get (font_name);
a5bd9f6
-  if (!virtual_screen.font)
a5bd9f6
-    return grub_error (GRUB_ERR_BAD_FONT,
a5bd9f6
-                       "no font loaded");
a5bd9f6
+  virtual_screen.font = font;
a5bd9f6
   virtual_screen.width = width;
a5bd9f6
   virtual_screen.height = height;
a5bd9f6
   virtual_screen.offset_x = x;
a5bd9f6
@@ -282,7 +279,7 @@ grub_err_t
a5bd9f6
 grub_gfxterm_set_window (struct grub_video_render_target *target,
a5bd9f6
 			 int x, int y, int width, int height,
a5bd9f6
 			 int double_repaint,
a5bd9f6
-			 const char *font_name, int border_width)
a5bd9f6
+			 grub_font_t font, int border_width)
a5bd9f6
 {
a5bd9f6
   /* Clean up any prior instance.  */
a5bd9f6
   destroy_window ();
a5bd9f6
@@ -294,7 +291,7 @@ grub_gfxterm_set_window (struct grub_video_render_target *target,
a5bd9f6
   if (grub_virtual_screen_setup (border_width, border_width, 
a5bd9f6
                                  width - 2 * border_width, 
a5bd9f6
                                  height - 2 * border_width, 
a5bd9f6
-                                 font_name) 
a5bd9f6
+                                 font) 
a5bd9f6
       != GRUB_ERR_NONE)
a5bd9f6
     {
a5bd9f6
       return grub_errno;
a5bd9f6
@@ -321,6 +318,7 @@ grub_gfxterm_fullscreen (void)
a5bd9f6
   grub_video_color_t color;
a5bd9f6
   grub_err_t err;
a5bd9f6
   int double_redraw;
a5bd9f6
+  grub_font_t font;
a5bd9f6
 
a5bd9f6
   err = grub_video_get_info (&mode_info);
a5bd9f6
   /* Figure out what mode we ended up.  */
a5bd9f6
@@ -346,12 +344,16 @@ grub_gfxterm_fullscreen (void)
a5bd9f6
   if (! font_name)
a5bd9f6
     font_name = "";   /* Allow fallback to any font.  */
a5bd9f6
 
a5bd9f6
+  font = grub_font_get (font_name);
a5bd9f6
+  if (!font)
a5bd9f6
+    return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
a5bd9f6
+
a5bd9f6
   grub_gfxterm_decorator_hook = NULL;
a5bd9f6
 
a5bd9f6
   return grub_gfxterm_set_window (GRUB_VIDEO_RENDER_TARGET_DISPLAY,
a5bd9f6
 				  0, 0, mode_info.width, mode_info.height,
a5bd9f6
 				  double_redraw,
a5bd9f6
-				  font_name, DEFAULT_BORDER_WIDTH);
a5bd9f6
+				  font, DEFAULT_BORDER_WIDTH);
a5bd9f6
 }
a5bd9f6
 
a5bd9f6
 static grub_err_t
a5bd9f6
diff --git a/include/grub/gfxterm.h b/include/grub/gfxterm.h
a5bd9f6
index 3fc8d92..361f73e 100644
a5bd9f6
--- a/include/grub/gfxterm.h
a5bd9f6
+++ b/include/grub/gfxterm.h
a5bd9f6
@@ -23,12 +23,13 @@
a5bd9f6
 #include <grub/types.h>
a5bd9f6
 #include <grub/term.h>
a5bd9f6
 #include <grub/video.h>
a5bd9f6
+#include <grub/font.h>
a5bd9f6
 
a5bd9f6
 grub_err_t
a5bd9f6
 EXPORT_FUNC (grub_gfxterm_set_window) (struct grub_video_render_target *target,
a5bd9f6
 				       int x, int y, int width, int height,
a5bd9f6
 				       int double_repaint,
a5bd9f6
-				       const char *font_name, int border_width);
a5bd9f6
+				       grub_font_t font, int border_width);
a5bd9f6
 
a5bd9f6
 typedef void (*grub_gfxterm_repaint_callback_t)(int x, int y,
a5bd9f6
                                                 int width, int height);
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6