summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-03-26 04:09:39 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-03-26 04:09:39 +0100
commit64b5d358fcaa039ca2e7634aceaa5ed4c3a10cc4 (patch)
treefd0fec2d1c148bbae1a402185984b28521ce5851
parent17126af519bf8e43ecef76c4ebd7f205c4c4daa8 (diff)
Handle fonts with multiple-of-8 bbox width
* console-client/vga-dynafont.c (dynafont_new): When the bbox width of the font is a multiple of 8, set width to 8. Reject any other value than 8 or 9 with EINVAL.
-rw-r--r--console-client/vga-dynafont.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/console-client/vga-dynafont.c b/console-client/vga-dynafont.c
index 5e3bc6d1..573d63b4 100644
--- a/console-client/vga-dynafont.c
+++ b/console-client/vga-dynafont.c
@@ -480,6 +480,12 @@ dynafont_new (bdf_font_t font, bdf_font_t font_italic, bdf_font_t font_bold,
font = create_system_font ();
if (!font || !font->bbox.height)
return errno;
+ if (!width)
+ width = font->bbox.width;
+ if ((width % 8) == 0)
+ width = 8;
+ if (width != 8 && width != 9)
+ return EINVAL;
df = malloc (sizeof *df);
if (!df)
@@ -494,8 +500,6 @@ dynafont_new (bdf_font_t font, bdf_font_t font_italic, bdf_font_t font_bold,
df->font_bold = font_bold;
df->font_bold_italic = font_bold_italic;
df->size = size;
- if (!width)
- width = df->font->bbox.width;
df->width = width;
df->cursor_standout = 0;