grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] Improve DejaVuSans detection
Date: Sun, 26 Jan 2014 00:05:31 +0400	[thread overview]
Message-ID: <20140126000531.2d6d1686@opensuse.site> (raw)
In-Reply-To: <52DEFFDC.40607@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2836 bytes --]

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

> 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 <arvidjaar@gmail.com>
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2014-01-25 20:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-12 12:15 [PATCH] look for DejaVu also in /usr/share/fonts/truetype Andrey Borzenkov
2014-01-18 15:58 ` [PATCH] Improve DejaVuSans detection Andrey Borzenkov
2014-01-18 16:26   ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-01-18 17:04     ` Andrey Borzenkov
2014-01-21  7:40       ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-01-21 16:18         ` Andrey Borzenkov
2014-01-21  7:46   ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-01-21 16:16     ` Andrey Borzenkov
2014-01-21 23:16       ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-01-25 20:05         ` Andrey Borzenkov [this message]
2014-01-21  7:29 ` [PATCH] look for DejaVu also in /usr/share/fonts/truetype Vladimir 'φ-coder/phcoder' Serbinenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140126000531.2d6d1686@opensuse.site \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).