grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Improve DejaVuSans detection


From: Andrey Borzenkov
Subject: Re: [PATCH] Improve DejaVuSans detection
Date: Sun, 26 Jan 2014 00:05:31 +0400

В Wed, 22 Jan 2014 00:16:44 +0100
Vladimir 'φ-coder/phcoder' Serbinenko <address@hidden> пишет:

> On 21.01.2014 17:16, Andrey Borzenkov wrote:
> > Yes, I realized that. The problem is, unifont may be missing (user is
> > free to override it with GRUB_FONT)
> If user overrides our fonts and gets ugly display it's his fault. You
> can assume unifont availability.
> 

Yes, but as we have just seen I cannot be sure about font *name*. The
patch below makes it return the very first loaded font which in normal
case is Unifont. So removing explicit font from starfield will result in
loading unifont but won't depend on particular font name.

From: Andrey Borzenkov <address@hidden>
Subject: [PATCH] Do not set explicit font in starfield theme

DejaVuSans is proportional and looks bad in terminal window. DejaVuSansMono
also results in suboptimal display. Unifont is better but apparently font
name may be different on different distributions. So simply delete explicit
font name for terminal window; this will cause the very first font to be loaded
and normally the very first font is Unifont.

---
 grub-core/font/font.c      | 12 +++++++-----
 themes/starfield/theme.txt |  1 -
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/grub-core/font/font.c b/grub-core/font/font.c
index 14b93e1..9e92e1f 100644
--- a/grub-core/font/font.c
+++ b/grub-core/font/font.c
@@ -861,18 +861,20 @@ grub_font_t
 grub_font_get (const char *font_name)
 {
   struct grub_font_node *node;
+  struct grub_font_node *last_node = NULL;
 
-  for (node = grub_font_list; node; node = node->next)
+  for (node = grub_font_list; node; last_node = node, node = node->next)
     {
       grub_font_t font = node->value;
       if (grub_strcmp (font->name, font_name) == 0)
        return font;
     }
 
-  /* If no font by that name is found, return the first font in the list
-     as a fallback.  */
-  if (grub_font_list && grub_font_list->value)
-    return grub_font_list->value;
+  /* If no font by that name is found, return the last font in the list
+     as a fallback. Last font is the one loaded first which is Unifont in
+     standard grub.cfg  */
+  if (last_node && last_node->value)
+    return last_node->value;
   else
     /* The null_font is a last resort.  */
     return &null_font;
diff --git a/themes/starfield/theme.txt b/themes/starfield/theme.txt
index 5ec871b..cea799b 100644
--- a/themes/starfield/theme.txt
+++ b/themes/starfield/theme.txt
@@ -25,7 +25,6 @@ message-font: "DejaVu Sans Regular 12"
 message-color: "#000"
 message-bg-color: "#fff"
 terminal-box: "terminal_box_*.png"
-terminal-font: "DejaVu Sans Regular 12"
 desktop-image: "starfield.png"
 
 #help bar at the bottom
-- 
tg: (5ae584c..) u/dejavu-path (depends on: master)

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]