TApxCharSetMapping.LoadFromFile

TApxCharSetMapping

procedure LoadFromFile(const aFileName : string);

Loads a set of character set mappings from a text file.

The name of the file is given by aFileName.

The file is a text file in a particular format. LoadFromFile will follow these rules when reading the file:

·Any completely blank line is ignored.

·Any line starting with a * is a comment and is skipped.

·Any line starting with at least one space is a detail line. A detail line consists of five words. A word is defined as a set of up to 63 characters without an embedded space, or as a set of up to 63 characters enclosed by quote marks (single or double). A word is case sensitive. Words are separated by spaces (not tab characters). Any other characters appearing after the five words are taken to be a comment and are skipped.

·Any detail line that cannot be parsed is simply ignored.

·Any line that doesn't match the above is skipped.

The five words, in order, are the same as the five parameters to the Add method. They denote the following:

·The character set name.

·The from character for the range.

·The to character for the range.

·The font name.

·The from glyph for the range.

The words that define a character can either be the character itself or be the hex representation of the character in the form \xnn with "nn" being the hex value. Hence, the space character would be represented by \x20, and the character 'a' would be shown by the single letter a.

To help in designing portable character set mappings, one special value can be used for the font name. If the name is "<Default>", the emulator will use the currently defined font for the terminal component to display text.

An example of defining a character set mapping for the standard ASCII characters would be:

* This defines the standard ASCII characters
MyCharSet \x20 ~ 'terminal (dec)' \x20

The character set name is "MyCharSet". The range of characters is from the space character to the '~' character, inclusive. The font name is "terminal (dec)". The starting glyph is that for the space character.

Please see AXCHSVT1.TXT for a complete set of mappings that define one way of mapping the VT100 character sets keys onto standard fonts.

The only errors than can occur with LoadFromFile are file I/O errors. Internally LoadFromFile uses a string list (TStringList) to read the entire file into memory and so any exceptions raised will be those raised by this class.

See also: Add