» Content »pkg://svgalib-1.28-6.tar.gz:365366
/ info downloads
1. Restoring corrupted textmode fonts.
If XFree86 corrupts your textmode font, try putting restorefont
in your path and using the shell script runx to run X. runx saves
the VGA font data in /tmp/fontdata, and restores it when you exit X.
Note that this doesn't help with syncing problems.
A more rigorous alternative is to run the 'savetextmode' script before
running X, and 'textmode' after. This will restore the textmode registers
and the VGA palette in addition to the VGA font.
2. Changing the textmode font.
The VGA font format:
0-31 character 0
8164-8195 character 255
Each row of a character bitmap is stored as a byte (8 pixels).
The space that is left from the 32-byte buffer for each character
is ignored, e.g. a 16-line font uses only offsets 0-15 of each character.
Linux text resolutions:
80x25 16 line font 400 scanlines
80x28 14 line font 400 scanlines
80x50 8 line font 400 scanlines
The font sizes and resolutions of extended textmodes depend on the
video card type and BIOS:
132x25 14 line font 350 scanlines (ugly)
132x25 16 line font 400 scanlines
132x43 8 line font 350 scanlines (use fix132x43 to fix/improve)
132x50 8 line font 400 scanlines
To load a font into video memory, use
restorefont -r fontname
Using a font that has less lines per character than the textmode works, but
the characters are smaller. Using a font that is bigger than the textmode
font results in the bottom part of characters being cut off.
I've included sample fonts with 8, 14 and 16 line characters.
The convfont program can be used to convert fonts straightforwardly stored
character-after-character (i.e. each character only uses 8/14/whatever
bytes), to the 32-byte per character format that restorefont requires.
3. Setting the VGA palette
'restorepalette' sets the standard VGA palette; this can be useful
if it is somehow messed up. With a filename argument a custom
palette can be loaded (added by Charles Blake,
The changes allow a user to set up a file that looks like this one:
0 0 0 0 # black THESE COLOR MAP DEFINITIONS ARE
1 0 0 42 # blue THE SAME AS THE DEFAULT VGA ONES
2 0 42 0 # green
3 0 42 42 # cyan ALTER TO SUITE PERSONAL TASTES
4 42 0 0 # red
5 42 0 42 # magenta
6 42 21 0 # brown
7 42 42 42 # white
8 21 21 21 # bright black
9 21 21 63 # bright blue
10 21 63 21 # bright green
11 21 63 63 # bright cyan
12 63 21 21 # bright red
13 63 21 63 # bright magenta
14 63 63 21 # bright brown
15 63 63 63 # bright white
Then run the command "restorepalette pathname". The inline comments are the
only kind allowed, as I use a little fscanf() trick to get them. Blank lines
are ok, but not pure comment lines. See the comments in my code, also.
This allows people to set up custom palettes for use in virtual console text
modes. I use it all the time. When combined with a color-syntax editor like
jed-0.97+ or color-ls, etc, being able to choose your own text-mode palette is
quite a bonus. I set mine up via "restorepalette /etc/palette" in my /etc/rc.
If the program is given the correct permissions, then individual users can
have "restorepalette ~/.palette" or some such thing in their shell startup
files. Of course, it shouldn't be done when starting remote shells or when
under X, so some kind of test that TERM is a virtual console is needed for
The national/fontpak packages, which include kernel patches, allow different
textmode fonts to be used in different virtual consoles. These have been
superseded by the kbd package (in the kernel since pl15).