mapscrn
Modify the console's character screen mapping
SYNOPSIS
mapscrn [options] mapfile
mapscrn -V | --version
PARAMETERS
mapfile
The path to the file containing the screen font mapping table. This file typically specifies pairs of old character codes and their new character code mappings.
-V, --version
Displays the version information for the `mapscrn` command and then exits.
-o, --old-kmap
Instructs `mapscrn` to interpret the `mapfile` in the old `loadkeys` keymap format. This option is primarily for backward compatibility.
DESCRIPTION
The `mapscrn` command, part of the `kbd` package, is used to load a screen font mapping table onto the Linux console. This mapping table defines how characters displayed on the screen are translated from their original code points to different glyphs. Its primary purpose is to allow the display of characters that might not be directly available in the currently loaded console font.
For example, it can be used for internationalization purposes to correctly render characters from various character sets, or to create pseudo-graphic effects by remapping specific character codes to alternative visual representations. `mapscrn` operates on the kernel's virtual consoles (e.g., `/dev/tty1`, `/dev/tty2`). It works in conjunction with `setfont`, which loads the actual raw console font, and `loadkeys`, which manages keyboard input mappings. By loading a custom mapping table, `mapscrn` provides a layer of translation between the character code sent to the console and the final glyph displayed. It's particularly useful in environments where a specific font may lack certain characters, and a mapping can point to other existing glyphs within the font to represent them.
CAVEATS
Executing `mapscrn` typically requires root privileges to modify console settings.
This command primarily affects the kernel's virtual consoles (e.g., `/dev/ttyS0-63`). It does not impact characters displayed in graphical environments like Xorg or Wayland, which manage their own fonts and rendering.
With the increasing adoption of Unicode and modern font rendering capabilities in the Linux kernel and userspace, the direct need for `mapscrn` has somewhat diminished for general internationalization, but it remains useful for specialized console applications.
<B>MAPFILE FORMAT</B>
A `mapfile` typically contains 256 lines, with each line specifying a mapping for one of the 256 possible byte values. Each line consists of two numbers: the original character code (0-255) and the new character code to which it should be remapped. For example, `128 0x1B` would remap character code 128 to the Escape character. Comments can be added using a '#' symbol, and blank lines are ignored. The mapping defines how the kernel should interpret output bytes before rendering them with the currently loaded console font.
<B>TYPICAL USE CASES</B>
While less common in everyday desktop usage, `mapscrn` is useful in several scenarios:
Internationalization on console: To display characters not natively supported by the console's character set, by remapping them to existing glyphs within the loaded font.
Pseudo-graphics: To remap ASCII characters to specific graphic characters (e.g., box drawing characters) to create text-based interfaces or games.
Legacy systems: For compatibility with older applications or data that rely on specific character encodings or console behaviors.
HISTORY
`mapscrn` is an integral part of the `kbd` package, a collection of utilities designed for managing the Linux console's keyboard and screen. Its development stems from the early days of Linux when direct control over console fonts and character rendering was crucial for supporting various character sets and internationalization without relying on graphical environments. While its core functionality remains, its usage has evolved, with more modern systems often handling character encoding and display at higher layers (e.g., using UTF-8 and Unicode-aware fonts) which can reduce the direct need for manual screen mapping tables. However, it continues to be relevant for embedded systems, rescue environments, or specific console-only configurations where fine-grained control over character display is necessary.