Skip to contentSkip to conversation

do not reset console font when running utils on Windows

PATCH In review Andrey Borzenkov 2 participants 3 messages Dec 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 do not reset console font when running utils on Windows

This is not required as utilities provide just simple text output. This avoids surprising unexpected change of window look'n'feel.

---
 grub-core/osdep/windows/init.c | 4 ++++
 1 file changed, 4 insertions(+)
grub-core/osdep/windows/init.c +4 -0
index 98c325c..629d785 100644
@@ -30,6 +30,7 @@
 
 #include "progname.h"
 
+#ifndef GRUB_UTIL
 struct grub_windows_console_font_infoex {
   ULONG cbSize;
   DWORD nFont;
@@ -111,6 +112,7 @@ set_console_unicode_font (void)
 	func_SetConsoleFont (err_handle, 12);
     }
 }
+#endif
 
 static char *grub_util_base_directory;
 static char *locale_dir;
@@ -148,10 +150,12 @@ grub_util_host_init (int *argc __attribute__ ((unused)),
 {
   char *ptr;
 
+#infdef GRUB_UTIL
   SetConsoleOutputCP (CP_UTF8);
   SetConsoleCP (CP_UTF8);
 
   set_console_unicode_font ();
+#endif
 
 #if SIZEOF_TCHAR == 1
 
Signature · 1 line
tg: (645ff63..) u/mingw/console-font (depends on: master)
#1 lore raw
Quoted 3 lines · Andrey Borzenkov

This is not required as utilities provide just simple text output. This avoids surprising unexpected change of window look'n'feel.

Without it windows is unable to output any character outside of default character set.

Quoted 38 lines
---
 grub-core/osdep/windows/init.c | 4 ++++
 1 file changed, 4 insertions(+)
grub-core/osdep/windows/init.c +4 -0
index 98c325c..629d785 100644
@@ -30,6 +30,7 @@
 
 #include "progname.h"
 
+#ifndef GRUB_UTIL
 struct grub_windows_console_font_infoex {
   ULONG cbSize;
   DWORD nFont;
@@ -111,6 +112,7 @@ set_console_unicode_font (void)
 	func_SetConsoleFont (err_handle, 12);
     }
 }
+#endif
 
 static char *grub_util_base_directory;
 static char *locale_dir;
@@ -148,10 +150,12 @@ grub_util_host_init (int *argc __attribute__ ((unused)),
 {
   char *ptr;
 
+#infdef GRUB_UTIL
   SetConsoleOutputCP (CP_UTF8);
   SetConsoleCP (CP_UTF8);
 
   set_console_unicode_font ();
+#endif
 
 #if SIZEOF_TCHAR == 1
 
#2 lore raw

В Пт, 27/12/2013 в 19:14 +0100, Vladimir 'φ-coder/phcoder' Serbinenko пишет:

Quoted 6 lines · Andrey Borzenkov
Quoted 3 lines

This is not required as utilities provide just simple text output. This avoids surprising unexpected change of window look'n'feel.

Without it windows is unable to output any character outside of default character set.

I was not able to make any grub utility to output anything beyond standard English messages. Does l10n work for you on Windows?