[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
simple path search for vga fonts
From: |
James A Morrison |
Subject: |
simple path search for vga fonts |
Date: |
Sun, 5 Jan 2003 15:59:56 -0500 (EST) |
Hi,
After discovering I could recover my vga console by specifying a font,
I decided I wanted a system font directory, so I made one. Here is the
patch.
James A. Morrison
2003-01-05 James A. Morrison <ja2morri@uwaterloo.ca>
* vga.c (DEFAULT_VGA_FONT_PATH): Default path for vga fonts.
(LOAD_FONT): Add search of DEFAULT_VGA_FONT_PATH for font.
Index: vga.c
===================================================================
RCS file: /cvsroot/hurd/hurd/console-client/vga.c,v
retrieving revision 1.1
diff -u -b -r1.1 vga.c
--- vga.c 17 Sep 2002 12:26:10 -0000 1.1
+++ vga.c 5 Jan 2003 20:57:15 -0000
@@ -1,5 +1,5 @@
/* vga.c - The VGA device display driver.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann.
This file is part of the GNU Hurd.
@@ -49,17 +49,18 @@
#define VGA_DISP_HEIGHT 25
/* The font file. */
-#define DEFAULT_VGA_FONT "/lib/hurd/fonts/vga-system.bdf"
+#define DEFAULT_VGA_FONT_PATH "/lib/hurd/fonts/"
+#define DEFAULT_VGA_FONT DEFAULT_VGA_FONT_PATH "vga-system.bdf"
static char *vga_display_font;
-#define DEFAULT_VGA_FONT_ITALIC "/lib/hurd/fonts/vga-system-italic.bdf"
+#define DEFAULT_VGA_FONT_ITALIC DEFAULT_VGA_FONT_PATH "vga-system-italic.bdf"
static char *vga_display_font_italic;
-#define DEFAULT_VGA_FONT_BOLD "/lib/hurd/fonts/vga-system-bold.bdf"
+#define DEFAULT_VGA_FONT_BOLD DEFAULT_VGA_FONT_PATH "vga-system-bold.bdf"
static char *vga_display_font_bold;
#define DEFAULT_VGA_FONT_BOLD_ITALIC \
- "/lib/hurd/fonts/vga-system-bold-italic.bdf"
+ DEFAULT_VGA_FONT_PATH "vga-system-bold-italic.bdf"
static char *vga_display_font_bold_italic;
/* The timer used for flashing the screen. */
@@ -237,6 +238,18 @@
#define LOAD_FONT(x,y) \
do { \
font_file = fopen (vga_display_##x ?: DEFAULT_VGA_##y, "r"); \
+ if (!font_file) \
+ { \
+ char *vga_system_font; \
+ asprintf (&vga_system_font, "%s/%s.bdf", DEFAULT_VGA_FONT_PATH,
vga_display_##x); \
+ font_file = fopen (vga_system_font, "r"); \
+ free (vga_system_font); \
+ } \
+ if (!font_file) \
+ { \
+ error (0, 0, "The font %s is unavailable", vga_display_##x ?:
DEFAULT_VGA_##y); \
+ font_file = fopen (DEFAULT_VGA_##y, "r"); \
+ } \
if (font_file) \
{ \
bdf_error_t bdferr = bdf_read (font_file, &x, NULL); \
2003-01-05 James A. Morrison <ja2morri@uwaterloo.ca>
* vga.c (DEFAULT_VGA_FONT_PATH): Default path for vga fonts.
(LOAD_FONT): Add search of DEFAULT_VGA_FONT_PATH for font.
Index: vga.c
===================================================================
RCS file: /cvsroot/hurd/hurd/console-client/vga.c,v
retrieving revision 1.1
diff -u -b -r1.1 vga.c
--- vga.c 17 Sep 2002 12:26:10 -0000 1.1
+++ vga.c 5 Jan 2003 20:41:17 -0000
@@ -1,5 +1,5 @@
/* vga.c - The VGA device display driver.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Written by Marcus Brinkmann.
This file is part of the GNU Hurd.
@@ -49,17 +49,18 @@
#define VGA_DISP_HEIGHT 25
/* The font file. */
-#define DEFAULT_VGA_FONT "/lib/hurd/fonts/vga-system.bdf"
+#define DEFAULT_VGA_FONT_PATH "/lib/hurd/fonts/"
+#define DEFAULT_VGA_FONT DEFAULT_VGA_FONT_PATH "vga-system.bdf"
static char *vga_display_font;
-#define DEFAULT_VGA_FONT_ITALIC "/lib/hurd/fonts/vga-system-italic.bdf"
+#define DEFAULT_VGA_FONT_ITALIC DEFAULT_VGA_FONT_PATH "vga-system-italic.bdf"
static char *vga_display_font_italic;
-#define DEFAULT_VGA_FONT_BOLD "/lib/hurd/fonts/vga-system-bold.bdf"
+#define DEFAULT_VGA_FONT_BOLD DEFAULT_VGA_FONT_PATH "vga-system-bold.bdf"
static char *vga_display_font_bold;
#define DEFAULT_VGA_FONT_BOLD_ITALIC \
- "/lib/hurd/fonts/vga-system-bold-italic.bdf"
+ DEFAULT_VGA_FONT_PATH "vga-system-bold-italic.bdf"
static char *vga_display_font_bold_italic;
/* The timer used for flashing the screen. */
@@ -237,6 +238,15 @@
#define LOAD_FONT(x,y) \
do { \
font_file = fopen (vga_display_##x ?: DEFAULT_VGA_##y, "r"); \
+ if (!font_file) \
+ { \
+ char *vga_system_font; \
+ asprintf (&vga_system_font, "%s/%s.bdf", DEFAULT_VGA_FONT_PATH,
vga_display_##x); \
+ font_file = fopen (vga_system_font, "r"); \
+ free (vga_system_font); \
+ } \
+ if (!font_file) \
+ font_file = fopen (DEFAULT_VGA_##y, "r"); \
if (font_file) \
{ \
bdf_error_t bdferr = bdf_read (font_file, &x, NULL); \
- simple path search for vga fonts,
James A Morrison <=