diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-02-13 02:27:49 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-02-13 02:27:49 +0100 |
commit | bfa5d8f54612811d306d1453b7d2da549bbc60ee (patch) | |
tree | 2d2aa2b167d5ce5031d5978f44fddaa722fb07cc /console-client/vga.c | |
parent | c8b5250cc50a3451ecce9685d8b3457b3c1b133d (diff) |
Add --font-width option to force 8/9 pixel font width
This permits to choose between 720x400 or 640x400 textmode without
changing the font.
* console-client/vga-hw.h (VGA_ATTR_MODE_ADDR, VGA_ATTR_MODE_LGE,
VGA_ATTR_ENABLE_ADDR): New macros.
* console-client/vga-support.c (vga_state): Add `attr_mode' field.
(vga_init): Save attribute mode subregister content. Re-enable the
screen after that.
(vga_fini): Restore attribute mode subregister content. Re-enable the
screen after that.
(vga_set_font_width): When the font width is set to 9, enable VGA LGE to
properly handle box-drawing unicode characters. Re-nable the screen
after that.
(vga_exchange_palette_attributes): Use VGA_ATTR_ENABLE_ADDR macro
instead of harcoded 0x20.
* console-client/vga-dynafont.h (dynafont_new): Add `width' parameter.
* console-client/vga-dynafont.c (dynafont): Add `width' field.
(dynafont_new): Add `width' parameter, stored in `width' field of `df',
but using the font bbox as default value. Use it to decide whether to
use VGA LGE or not.
(dynafont_activate): Use `width' field of `df' instead of the font bbox
to configure the VGA glyph width.
* console-client/vga.c (vga_display_font_width): New variable.
(vga_display): New `df_width' field.
(argp_option): New `font-width' option.
(parse_opt): Handle `font-width' option.
(vga_display_init): Copy `vga_display_font_width' to `disp'.
(vga_display_start): Pass `df_width' to `dynafont_new'.
Diffstat (limited to 'console-client/vga.c')
-rw-r--r-- | console-client/vga.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/console-client/vga.c b/console-client/vga.c index 8a3260bf..cf6c8c35 100644 --- a/console-client/vga.c +++ b/console-client/vga.c @@ -65,6 +65,9 @@ static char *vga_display_font_bold_italic; /* If false use all colors, else use double font slots. */ static int vga_display_max_glyphs; +/* width of glyphs. */ +static int vga_display_font_width; + /* The timer used for flashing the screen. */ static struct timer_list vga_display_timer; @@ -107,6 +110,7 @@ struct vga_display /* The VGA font for this display. */ dynafont_t df; int df_size; + int df_width; /* The color palette. */ dynacolor_t dc; @@ -209,6 +213,7 @@ static const struct argp_option options[] = "Prefer a lot of colors above a lot of glyphs"}, {"max-glyphs", 'g', 0 , 0, "Prefer a lot of glyphs above a lot of colors"}, + {"font-width", 'w', "NUM" , 0, "Force using NUM pixel-wide glyphs"}, { 0 } }; @@ -251,6 +256,10 @@ parse_opt (int key, char *arg, struct argp_state *state) vga_display_max_glyphs = 1; break; + case 'w': + vga_display_font_width = atoi (arg); + break; + case ARGP_KEY_END: break; @@ -292,6 +301,7 @@ vga_display_init (void **handle, int no_exit, int argc, char *argv[], return ENOMEM; disp->df_size = vga_display_max_glyphs ? 512 : 256; + disp->df_width = vga_display_font_width; disp->width = VGA_DISP_WIDTH; disp->height = VGA_DISP_HEIGHT; @@ -338,7 +348,7 @@ vga_display_start (void *handle) LOAD_FONT (font_bold_italic, FONT_BOLD_ITALIC); err = dynafont_new (font, font_italic, font_bold, font_bold_italic, - disp->df_size, &disp->df); + disp->df_size, disp->df_width, &disp->df); if (err) { free (disp); |