Setting the Text Resolution

One key attribute of graphical video modes as used by X is their resolution—how many pixels are displayed, both horizontally and vertically. Text mode, too, sets a specific resolution. The combination of this resolution and the size of the characters that make up the font determine how many characters can be displayed on the screen. Therefore, one way to adjust the number of characters displayed on the screen is to adjust the underlying resolution. There are two ways to do this:

Modifying the Kernel You can alter a kernel to use a specific video mode using the vidmode command. You pass numerical codes to be used as video modes; for instance, -2 enables an extended VGA mode that doubles the number of lines of the display. To use this mode, you'd type vidmode /boot/bzlmage -2, where /boot/bzlmage is your Linux kernel filename. One problem with this approach is that it's difficult to test, because you must reboot before the new mode takes effect.

Passing Kernel Options You can pass options to the kernel using your boot loader to enable a specific video mode at system startup. For instance, if you use the Linux Loader (LILO), you can use the vga=mode line in lilo.conf, where mode is normal for an 80 x 25 display or ext for an 80 x 50 display. Like modifying the kernel, passing kernel options requires a reboot.

Using SVGATextMode The SVGATextMode program (headquartered at http://freshmeat.net/proiects/svgatextmode/) is a flexible program for setting text modes without modifying the kernel. You can set up text modes that aren't available in any other way using this tool, and you can change the text mode without rebooting the computer. Using this program overrides any options set in the kernel or by passing options to the kernel.

Because SVGATextMode is so flexible and complex, it deserves more explanation. This program comes with Debian, Mandrake, and SuSE in the svgatextmode, SVGATextMode, and svgatext packages, respectively. This tool uses a configuration file, /etc/TextConfig, that's similar to the XFree86 configuration file. The default configuration file is set up to support video modes that should work with any modern video card; but to get the most out of the package, you must reconfigure several details:

Chipset The Chipset line sets the video card chipset. The default value of VGA works with most modern video cards, but you may be able to get more or better options by selecting your true video card. Comment out the Chipset "VGA" line by placing a hash mark (#) at the start of the line, then locate the appropriate line for your video card and uncomment it. If you can't find an appropriate line, you may need to use the generic VGA configuration. You must also change the chipset clocks configuration when you change the chipset.

Chipset Clocks Different video cards support different dot clocks, which are low-level timing parameters. The VGA configuration includes a single Clocks line that sets two dot clocks. The configurations for specific video chipsets include one or more Clocks lines that specify many additional video clocks. Comment out the VGA configuration's Clocks line and uncomment the Clocks lines for your target video card.

Default Video Mode The DefaultMode line specifies the video mode the program sets if it is not given an explicit mode—80 x 25 is the default value. Change this line to read something else that you prefer, such as 132x50x8. Most modes are specified by the number of columns of characters by number of rows of characters by the character width in pixels. (The assumption is that characters are 16 pixels in height.) You can sometimes omit the character width, and some modes are preceded by special characters, such as v116x48. Most of the latter half of the TextConfig file is devoted to defining video modes, so you can pick a name from among these modes. You may want to leave this option alone until you've tested several modes and found the one you like.

Disk Synchronization A line that reads Option "SyncDisks" flushes your disk cache before doing anything. This is a safety measure in case the program causes a system hang. Once you've tested the program, you can comment this line out to speed up operation.

Font Selection The FontProg line points the system at a tool to set console fonts. These tools are described in the previous section, "Setting the Console Font." You can also specify the location and names of font files that SVGATextMode will load to create various display sizes. Some distributions, such as SuSE, may override these values with others specified in other files, such as /etc/sysconfig/console.

Video Refresh Rates Locate the lines, which are commented out by default, that set the HorizSync and VertRefresh values. Uncomment these lines and enter the values used in your XFree86 configuration file

(XF86Config orXF86Config-4, in /etc or/etc/X11). These values tell the system about your monitor's capabilities. You can also find the horizontal and vertical refresh rate values for your monitor in its manual.

Warning Setting incorrect HorizSync orVertRefresh rates can damage some monitors, so be sure to set these values correctly. Most modern monitors ignore out-of-range signals, but you shouldn't count on this happening.

There are many other configuration options in /etc/TextConfig, but most of these relate to very advanced settings, such as definitions for new video modes. You can select from any video mode you like by specifying it when you call the program; for instance:

# SVGATextMode 132x50x9

Warning If you've set options incorrectly in the configuration file, SVGATextMode can yield a garbled display or no display at all. I recommend you try setting the basic 80x25 mode first. If a subsequent call fails, you can then use the Up Arrow key to retrieve the first call via your shell's history and replay it, restoring the screen to legibility.

This example call configures the system to use a 132 x 50 display, using a 9-character-wide font. Try a few configurations using modes defined in the final half or so of the TextConfig file until you find one you like.

Tip If you have an LCD monitor, you can set a text mode using SVGATextMode so that the resolution in pixels exactly matches the capability of the monitor. For instance, consider a 1024 x 768 monitor and an 8 x 16 font. Dividing the horizontal and vertical resolutions by the horizontal and vertical font dimensions yields an optimal size of 128 * 48. This configuration will produce crisper text on an LCD monitor than you probably get by default. On the other hand, most LCD monitors accept a narrow range of refresh rates, so this approach may not work without creating custom resolution definitions, which is a tricky undertaking.

Once you've found a text mode that you like, you can set it as the default in the DefaultMode line in /etc/TextConfig. You may also want to create a custom startup script, as described in Chapter 9, "Bypassing Automatic Configurations To Gain Control," to set this mode whenever the system boots.

This document was created by an unregistered ChmMagic, please go to http://www.bisenter.com to regist* Using Color in Text Logins

Modern video cards can all produce color displays, even in text mode. Many text-mode programs, though, don't take advantage of this fact; they display plain text, possibly with a few effects such as bold or blinking text.

One common use of color in text mode is in file listings as produced by Is. You can see this effect by typing Is -color. Some distributions configure themselves to use this option by default whenever you type Is. If yours doesn't, but if you want to use this feature, edit your-/.bashrc file or a global shell configuration file, such as/etc/bashrc, to include the following line:

alias ls='ls -color'

As described in Chapter 4 an alias such as this modifies the way the system responds to the original command (Is in this case).

Team LIB

^ previous

0 0

Post a comment