|★ APPLICATIONS ★ UTILITAIRES RSX/LIGNE DE COMMANDE ★ EXTRA FONTS|CPC COMPUTING) ★|
|Extra Fonts|CPC Computing)||Applications Utilitaires Rsx/ligne De Commande|
Dress up your text with four bright new type faces, CHRIS NIXON shows you how
THOSE of you who have seen Microsoft's Gem - Graphics Environment Manager - in action on the Amstrad PC may have been impressed by the variety of on-screen fonts available. In fact Gem has about five typefaces, and these are used in pull-down menus to indicate the status of various system options, file types and so on.
If you entered my letterhead designer from the July 1988 issue of Computing with the Amstrad CPC, you will have seen that I incorporated a similar multi-font facility.
Quite a number of you have written asking about this particular feature, so in response to popular demand I've fished out that section from the machine code, added another frill -underlined text - and made it a standalone utility called Fonts. It will allow you to display on the screen text in one of five typefaces, each generated from the character set built into the machine.
After running the program you will have the five RSXs detailed in Table I. Simply select the font you require, and either type the appropriate RSX name or include it in your program. It should be noted that this facility does not work with text printed at the graphics cursor after using the TAG command. Some fonts, in particular the feint style, are most effective in 40 and 80 column modes. Mode 0 unfortunately shows up feint and italic text as being rather messy, while bold text appears altogether too chunky.
The principle behind the utility is very simple. Inside the lower ROM of your CPC are the definitions of the 255 displayable characters. These are stored as a table containing 255 groups of eight bytes in the same format used by Basic's SYMBOL command. Each byte in a group of eight refers to a horizontal row in the character, and each bit in a byte lights up the corresponding pixel.
Anyone in possession of Soft 968 -Amstrad's firmware guide - has access to all sorts of behind-the-scenes trickery, and Fonts makes heavy use of the firmware's ability to be intercepted, diverted, and generally fiddled about with. Each non-TAG character printed on your monitor is channelled through the jumpblock entry TXT WRITE CHAR at &BDD3. When run, the program diverts this entry to point to its own checking routine. It then installs the RSX commands which have the following effect on any characters passed to TXT WRITE CHAR:
First, a character's eight-byte matrix will be read from the ROM with TXT GET MATRIX, and stored in a buffer for editing. The way in which the buffer contents are then edited depends on which style is in operation.
After editing, character 255 is redefined with the new matrix by means of the firmware call TXT SET MATRIX. It is then sent to the firmware in place of the original character. When a INORMAL is issued, the stored copy of the entry for &BDD3 is replaced, returning control of character printing to the firmware.
The editing process used by Fonts is as follows. If the bold font is active, each of the eight bytes in the buffer is shifted one bit to the right, and superimposed on top of the original byte. This results in every dot in the character being made double-width, creating the bold effect.
Italics are achieved by shifting the top four bytes of each character one bit to the right, effectively slanting the text slightly. Underlining is created by simply making the bottom byte of the new matrix equal to 255 - a line of eight pixels.
Creating the feint font is a slightly more complicated process. Each byte in the character is doctored to mask out alternate bits, creating a stippled effect. To ensure proper stippling, the mask used must be inverted for every other byte of the character. In other words the first row is ANDed with &X10101010, and the next row with &X01010101.
And that's it. A simple utility that will add variety and a professional touch to your text.
CPC COMPUTING (09-1988)