File Format of "BBC Font" (&FF7) files

(You need to know how to redefine characters with VDU 23 for this to make sense. Read the "Redefining The System Font" article if in doubt.)

Now, when I were a lad (and this were all fields), I used to spend all my pocket money on Public Domain disks. Redefining the internal eight-by-eight font with BBC font files was quite a popular thing, especially before RISC OS switched over to using anti-aliased fonts in the Desktop. This was the extent of desktop customisation: You used to be able to get disks full of these font files, most of which made your desktop totally unreadable. It was also an easy way of making in-game text look that little bit different - for example, all 4th Dimension games switched to the 4D preferred font.

This shows the contents of the !E-TYPE folder - the 4th Dimension BBC font file is the one called "ECHAR".

The filetype of the BBC Font is &FF7. If you press F12 and type *SHOW, you'll see a line :

Alias$@RunType_FF7 : Print %0

This describes what happens when you double-click a BBC Font file: the command *Print <filename> is executed. Now, all that *Print does is take each byte of that file and send it to the VDU queue (you can find this out for yourself by typing *HELP PRINT).

Find a BBC font file, and load it into a hex-viewer (or !Edit, if you have nothing else). Referring back to the article on defining your own characters with the VDU command, you'll see that the file contains :

(each below is a single byte)

[23]                            (in hex this would be shown as '17')
[ASCII code of character]
[line one (top line)]
[line two]
[line three]
[line four]
[line five]
[line six]
[line seven]
[line eight (bottom line)]

... repeated for each character being redefined. So, all such a file is doing is VDU 23, <ascii value>, <eight bytes of definition> for each character, just as described in the "Redefining The System Font" article.

For a crummy example, here is a small BASIC program which will list all the characters and their definitions in such a file:

ch%=OPENIN "fontfile":REM Change the filename here
IF ch%=0 THEN END: REM Failed to open it!

DiM b%(10)

REPEAT
  REM Load in 10 bytes. The first byte will always be 23.
  FOR K%=1 TO 10
    b%(K%)=BGET#ch%
  NEXT

  REM Print results.
  PRINT "ASCII = ";b%(2);", definition = ";
  FOR K%=3 TO 10
    PRINT ;b%(K%);" ";
  NEXT
  PRINT

UNTIL EOF#ch%
CLOSE#ch%


Contributor: Kris Adcock