======================================================================
 MultiSpaced Fonts v2.1
======================================================================

    Well... If you' ve seen my MultiSpaced Fonts v2.0 in the last ABC
 Packets, I don't have many things to say. This  is  a  really  minor
 release, and I've only made two little changes to the code.

    First of all, A LOT of thanks to Denny VanderBerg. He  shows me a
 way to use  LINE  instead  of  PSET,  making the program 40% faster,
 and fifteen lines smaller. However, it doesn't work in italics mode,
 because QBasic  draws first  the  left side of the line, and when we
 draw  italics  we  starts in the right side. Result: the letters are
 vertically flipped.

    I decided to not put the documentation in the program's code, and
 I placed a font catalog instead. But now I will say you  how  to use
 MultiSpaced Fonts, and I'll tell you  a  little  about  my font file
 format. I'm working in a font editor, but it's not complete  yet. My
 TrueType converter probed to be unsuccessful.

======================================================================
 How to use MultiSpaced Fonts
======================================================================

    MSFonts21.bas contains three SUBs and  three FUNCTIONs. The first
 one we'll see is FUNCTION MSFontLoad.  This  FUNCTION  loads  a font
 file to a font data array, that must be defined in this way:

    DIM ArrayName (223, 16) AS INTEGER

    In this array  we  put  space  to  223  full width characters. If
 you're sure that the font  file  you're  loading  doesn't  have  any
 character with a width greater than 8, you can define:

    DIM ArrayName (223, 8) AS INTEGER

    However, be really careful with this. If you don't put room for a
 full width font, and then the user changes the font file to make the
 program look better, your program will issue an "Out of array space"
 error.

======================================================================
 FUNCTION MSFontLoad%
======================================================================

    Once the array is defined, you can use MSFontLoad to load a  font
 file. MSFontLoad will return True (-1) if load  was  successful,  or
 False (0) if it wasn't. You can load fonts in the  program's "body",
 like I do in the font catalog, but  it's not  a  good  idea, because
 if the load was not successful you'll need to stop your  program.  I
 suggest you make one array for every font, and then  load  all fonts
 you'll use during program initialization. To load a font, just enter
 it's filename and font data array name:

    Success% = MSFontLoad%("TIMES.FON", ArrayName())

    Then check Success% value to see if load was successful.

======================================================================
 SUB MSFontChar
======================================================================

    SUB MSFontChar is my routines' heart. The code is used  for every
 routine that prints text, and in  v2.1 is  faster,  thanks  to Denny
 VanderBerg. You will never need to call it directly, but if you want
 to, that's the way:

    First of all, you pass to it the X  and Y  coordinates  where you
 want to print text. This is a pixel-value. In  the example,  we will
 print at upper  left corner of screen, coordinates 0, 0. Next is the
 character's ASCII value. We'll print an  uppercase A, so we pass the
 65 value. Then, we pass the  color  to  draw width, in  our example,
 light gray (color entry 7). Then, we need to pass the font style.

    To get font style, you must OR these values:

    0 - Normal
    1 - Italic
    2 - Bold
    3 - Underline

    In our example, we'll print in Bold  Italic style. So, we pass 3.
 To end, you must pass the name of the font data array. We will print
 using the font in the ArrayName() array. This is  how  our call will
 look:

    MSFontChar 0, 0, 65, 7, 3, ArrayName()

======================================================================
 SUB MSFontPrint
======================================================================

    This is the routine that replaces standard  PRINT. You  must call
 it  with  four parameters: X and Y coordinates, string to print, and
 font data array. If we want to print "ABC" at upper left corner, and
 using ArrayName() font, we call:

    MSFontPrint 0, 0, "ABC", ArrayName()

    To change style and color, you can insert different control codes
 in the string. These codes starts with a caret (^). If  you  want to
 print a caret, you may put two carets in  the string: "Hi^^boy" will
 print "Hi^boy".

    ^Cnn  Changes to color nn. Always use two hex characters.
    ^B    Enables Bold style.
    ^b    Disables Bold style.
    ^I    Enables Italics style.
    ^i    Disables Italics style.
    ^U    Enables Underline style.
    ^u    Disables Underline style.

    So, if we want to print "ABC", but the A in  color  15 and normal
 style, the B in color 7 and italic  attribute, and C in  color 8 and
 bold attribute, we can use:

    MSFontPrint 0, 0, "^C0FA^C07^IB^i^C08^BC", ArrayName()

    Note that enable an  attribute  doesn't  disable  others. You can
 print bold italics by using "^B^IMy Text". You don't need to disable
 the  attributes  when  you  stop  printing;  MSFontPrint  resets all
 attributes before it prints anything.

======================================================================
 FUNCTION MSFontLen%
======================================================================

    This FUNCTION is used to get a string's pixel  length. The string
 pixel lenght changes with every font, so if  you want  to  put  text
 right-justified, you must get the length in the font you'll print it
 before you  can  print  it.  MSFontLen  requires two parameters: the
 string and the font data array. To get the length  of "ABC", we  can
 use:

    ABCLength% = MSFontLen%("ABC", ArrayName())

======================================================================
 SUB MSFontCenter
======================================================================

    This routine, that I trashed in v2.0 but Michael Wood and Gabriel
 Dos Santos wanted back, requires two  X coordinates,  and  print the
 text centered between the two. If we  want  to center "ABC" in color
 15 and Italics in the upper middle of screen 12, we can use:

    MSFontCenter 0, 639, 0, "^C0F^IABC", ArrayName()

======================================================================
 FUNCTION MSFontInput%
======================================================================

    My first try to put a replace to INPUT in  the MultiSpaced Fonts,
 MSFontInput also enhances the standard INPUT by letting you start it
 with characters already in the buffer.

    MSFontInput  requires  many  parameters.  We  have  the  X  and Y
 coordinates, also the string buffer, then the foreground color (used
 to draw the characters) and the background color (used to erase them
 when we press backspace) the font style (same as for MSFontChar) and
 the font data  array.  It  returns the ASCII code of the key used to
 exit function. It can be Enter, Escape,  Tab or  any special key, as
 the arrows, or F1 to F12.

    The  string returned can be printed directly with MSFontPrint. If
 the user enters a caret, the returned string  will  have  two carets
 instead. You *MUST* not enter a buffer that haves an alone caret, or
 MSFontInput will probably issue a error.

    If we want to show a input prompt in upper left corner of screen,
 using foreground color 15 and background 6, and  underlined italics,
 we can call:

    Key% = MSFontInput%(0, 0, Buffer$, 15, 6, 15, ArrayName())

    When you exit function, the Buffer$ string is updated, so be sure
 to pass a string variable and not a direct string.

======================================================================
 Font File Format
======================================================================

    Well... this is really a  simple  file  format,  without  headers,
 signatures or anything complex. For every one of the  223 characters,
 you have one integer that contains the character's width, and  then N
 integers, that can be used as LINE bitmasks.

 Example:

 05 00 FC FF 82 00 81 00 82 00 FC FF
 \wid/ \line bitmasks              /

    That means that character is  five pixels width, and follows five
 integers to be used as line bitmasks. In this example, we'll draw:

    FFFCh 1111111111111100
    0082h 0000000010000010
    0081h 0000000010000001
    0082h 0000000010000010
    FFFCh 1111111111111100

    That's the "A" character.

    Inmediately  follows  another   width   integer,  and  then  more
 bitmasks.  The  file  format  doesn't include any header that can be
 used to error checking, but if the width integer is less than one or
 greater than sixteen, that's a very bad  signal and  means  the file
 isn't a  font  file.  Also,  if  it  haves  less  or  more  than 223
 character data, means the file is damaged or incomplete.

    Please send any font you create to me.

======================================================================
 File List
======================================================================

MSFont21.bas -- The main program, 40% faster! Thanks Denny!
MSFont21.txt -- The documentation.
Arial.fon    -- Font: Arial
ArialNrw.fon -- Font: Arial Narrow
BookOldS.fon -- Font: Bookman Old Style
Courier.fon  -- Font: Courier New
CSansMS.fon  -- Font: Comic Sans MS
Garamond.fon -- Font: Garamond
LucidaC.fon  -- Font: Lucida Console
Symbol.fon   -- Font: Symbol
System.fon   -- Font: System
Tahoma.fon   -- Font: Tahoma
Times.fon    -- Font: Times New Roman
Verdana.fon  -- Font: Verdana

======================================================================
 History
======================================================================

 v2.1 - MSFontCenter is back, thanks to  Michael Wood and Gabriel Dos
        Santos for their feedback. Modified the normal printing style
        to use LINE instead of PSET, making it 40% faster (Thanks  to
        Denny VanderBerg). However, it doesn't work in italics  mode.
        Now includes twelve fonts.                           09-28-98

 v2.0 - Big changes in the code, mainly so I  can  understand my  own
        code :-). Added code  to change  styles in the same line, and
        erased the TextCenter routine.  Prefixed all SUBs with MSFont
        so they stay together in the SUBs list. Now loads  many fonts
        in  the  same  program,   and   includes  five  fonts.  Added
        MSFontInput routine. I think that "Multi-Spaced Font Managing
        routines" was a WAAAY too long (and stupid), so I renamed the
        program, just "MutiSpaced Fonts".                    08-10-98

 v1.5 - First  released version. It includes italics and a really bad
        way to change between font styles.                   06-10-98

 v1.0 - First almost-released version. It haves no italics, and a bug
        in the CharPrint SUB. I sent it to William Yu, but I finished
        v1.5 before it can reach anyone other than William.  05-20-98

======================================================================
