Name: TRUEFONT.Z80
Author: Andrew Owen
Copyright: (C) 1996

TrueFont Pro(TM)

Description:
TrueFont was supposed to be part of a suite of applications called PixelPro, only I only got as far as writing the font editor. It's written in compiled HisoftBASIC which means you'll need to crank the emulation speed up to make it useable. It's quite powerful in its own way, with support for normal fonts, UDGs and proportional fonts (with built in display code (borrowed from Your Spectrum). Unfortunately, although you should be able to edit 64 column (384 byte) fonts, you can't, because I put the wrong value in and so it only saves 368 bytes, and then I lost the source code. If you can disassemble it and fix it that would be cool but I have a horrible feeling I used self modifying code to poke the value into the memory address -- Hisoft BASIC doesn't support LOAD/SAVE commands so I had to write the loader/saver in machine code - my first ever spectrum m/c program in fact. I've included the only source information I have in the file pixelpro.inf. The code in 42co.Z80 is a modified version of the proportional font code which doesn't need to use the first byte of a character to tell how wide it is, because it knows it is six pixels wide.

Instructions: (taken from PixelPro manual (written before the program))

    TRUEFONT(TM) PRO
    This is the original program that Pixelpro grew out of.
    When you select this option you will see the edit screen.
    The font you are working on is displayed under the standard
    character set in yellow and the numbers on the left are the
    decimal values for that line of the character (in case you
    want to use them in data statements). The cursor keys move
    the pointer and zero changes a pixel. The commands on the
    right-hand menu are accessed by pressing the key that
    corresponds to their first letter:

      LOAD
      The four types of characters are edited on the same screen
      and you simply choose the type when you save. UDGs and 64
      column fonts do not use all the character positions and so
      it is advisable to select New before loading either of
      these types. You do not need to tell TrueFont what type
      you are loading but you should not load anything other
      than font and UDG data as this could corrupt the program
      and result in a crash. If you do not enter a file name the
      next data file will be loaded.
    
      SAVE
      Before you are asked for a file name you must specify what
      sort of data you wish to save. You can choose one of the
      four different types or you can return to editing the
      characters. Option one saves a normal font. Option two
      saves a proportional font with the extra code needed to
      use it. A proportional font can only be seven pixels high
      because the top line is used to store the width data. Load
      some of the example (PS) fonts to see how it works. If you
      save a proportional font without this data it will not
      print properly. If the top line is blank on all the
      characters the font will be monospaced. Proportional fonts
      are explained in greater detail later. Option three saves
      the first half of the font for use with YS Megabasic. When
      editing a 64 column font each 8x8 grid holds two
      characters. Load up the example font to see how it works.
      Option four saves the first 21 characters as a UDG bank.
     
      NEW
      This completely wipes the character set you are working on
      and replaces it with the default font. There is a warning
      first and typing anything other than "y" or "Y" will leave
      the font untouched.
     
      VIEW
      This option shows you what your font will look like. This
      is particularly useful when editing proportional fonts.
     
      GET
      This allows you to edit a specific character from the
      font. After you have selected Get, a pointer will appear
      over the font. You can move it over a character using the
      cursor keys. Pressing zero selects a character. The
      pointer moves faster than the edit pointer so that it does
      not take ages to go from the start to the end of the font
      but you must be carefull when you are moving over short
      distances.
     
      PUT
      This works in exactly the same way as Get, except that
      instead of retreiving a character it allows you to store a
      character.
     
      CLEAR
      This clears the grid. There is no warning so make sure you
      are certain before you select it.
     
      INVERT
      This inverts the grid, changing black to white and vice
      versa. It can be faster when editing very wide fonts to
      draw the white space on the grid instead of the character
      and then invert it before storing it.
  
      MIRROR
      This flips the character horizontaly. It is possible to do
      a vertical mirror by first rotating the character 180
      degrees.
  
      ROTATE
      This rotates the character clockwise. If you didn't mean
      to do it you can always rotate it 360 degrees.
  
      EXIT
      This returns you to the main menu.

      USING FONTS IN YOUR OWN PROGRAMS
      Exactly how you do this depends on what type of font you
      wish to use. It is also possible to have more than one
      type of font in the same program. The proportional font
      and the UDGs must be stored at specific memory locations
      but monospaced fonts can be stored anywhere.

      MONOSPACED FONTS
      If you only wish to use one font and are not using machine
      code in your program the easiest way to load these fonts
      is to type CLEAR 64199: LOAD "" CODE. To call the font
      POKE 23606,200: POKE 23607,249. To switch to the default
      font POKE 23606,0: POKE 23607,60. But, if you are have
      machine code storerd at that location, such as the
      proportional font routine, or want to use more than one
      font you will need to load the data at a different
      address. Normal fonts are 768 bytes long and can be stored
      anywhere in memory and called by changing the character
      set pointer. Here is an example program that loads a
      normal font at F7C8h (just below the proportional font):

        10 LET address=64342
        20 LET y=INT (address/256)-1
        30 LET x=address-(y+1)*256
        40 CLEAR address-1
        50 LOAD "" CODE address
        60 POKE 23606,x: POKE 23607,y

     If you are using YS MegaBasic you can replace the two extra
     fonts. To replace the first font type LOAD "" CODE 48000.
     To replace the second font type LOAD "" CODE 48000. On some
     emulators, such as MacSpectacle, you can overwrite the ROM.
     This allows you to change the default font. To do this type
     LOAD "" CODE 15616. It will survive the NEW command but if
     you do a hard reset you will have to reload it.

     PROPORTIONAL FONTS
     You can only have one proportional font in memory at a time
     and it is non-relocateable. To load it type CLEAR 64199:
     LOAD "" CODE: RANDOMIZE USR 65000. The routine hijacks the
     LPRINT command. To print proportional text type LPRINT AT
     x,y;"Hello sailor!". The variables "x" and "y" hold the
     horizontal and vertical pixel locations and can be from
     0-255 and 0-168 respectively. The characters are printed in
     the current ink and paper settings in over mode.

     64 COLUMN FONTS
     These can only be used with YS MegaBasic. If you want to
     use a 64 column font in Sinclair BASIC you should design it
     as a proportional font. To load it just type LOAD "" CODE.

     USER DESIGNED GRAPHICS
     If you only wish to use one UDG set, the easiest way to load
     it is to type LOAD ""CODE 65368. The characters are accessed
     from [G] mode by pressing A through U. But if you want to
     use more than one set you will need to load the data at a 
     different address. Sets are 168 bytes long and can be stored
     anywhere in memory, and called by changing the UDG pointer.
     Here is an example program that loads a set at FE60h, just
     below the first one: 

        10 LET address=65200
        20 LET y=INT (address/256)
        30 LET x=address-(y*256)
        40 CLEAR address-1
        50 LOAD "" CODE address
        60 POKE 23675,x: POKE 23676,y 

     The first bank is called with POKE 23675,88: POKE 23676,255.


-Andrew