----------------------------------------------------------------------------

QUESTION:
     How  do  I  create  my  own  fonts  for  use with my Windows
     programs using Resource Workshop?   How can I get Windows to
     recognize my font once it is created?

ANSWER:
     Creating the font:

     First,  you  can  use the Resource Workshop to create a .FNT
     font  file.    RW can edit both .FNT and .FON files, but can
     only create .FNT  files.  .FNT  files  are  individual fonts
     while  .FON   files   are   collections   of   .FNT   files.
     Unfortunately, Windows only works with  .FON  files,  so you
     must create one manually.  To see a related document on this
     topic, search for "FON files".  Once you have created a .FON
     file, you can use your new font(s) in your own applications!

     Loading the font:

     The first order of business is to get  Windows  to recognize
     the  font.  This can be accomplished in  one  of  two  ways.
     First, you can use the Windows Control Panel to add the font
     to the list of  system  fonts.  Alternately, you can use the
     function AddFontResource().   This function takes a filename
     and causes Windows to  load  your font.  Don't forget to use
     RemoveFontResource() when your program terminates.

     Using the font:

     First, you should initialize a  LOGFONT  structure  with the
     information describing the font that you wish to  use.   Use
     CreateFontIndirect to get a  handle  to  your  font (HFONT).
     Once this HFONT is selected  into a device context, any text
     output functions using that  device  context  will  use your
     font.

     Cleanup:

     You should  use DeleteObject to remove the font (HFONT) when
     you  are  finished  with  it.     Also,  if  you  have  used
     AddFontResource   to   load   the   font,  you  should  call
     RemoveFontResource.
 
----------------------------------------------------------------------------

Creating .FON files -- How to create Windows font libraries

What is a .FON file?

     A  .FON  file is a collection of  fonts  making  up  a  font
     library.  It is usually a collection of various sizes of the
     same font.  Windows  allows  you  to  install fonts into the
     system font list if they are  in  the .FON file format.  You
     can do this by  using  the  Control  Panel, or by installing
     them from within your application by using AddFontResource.

     NOTE: In order to make use  of  your font, you must create a
     .FON font library; even if you only have one font!

How do I create a font library?

     A font library is basically just a DLL with  an  empty  code
     segment and an file  extension  of .FON.  You may choose any
     name for your font library up to eight letters.   Before you
     begin, you will need the following:

         *  At least one .FNT font file  (possibly  created using
            Resource Workshop)

         *  A .ASM file containing the empty code segment

         *  A  .RC  file  listing the fonts to be included in the
            font library

         *  A .DEF file for the font library

The .ASM empty code segment module

     In  order to build the font library, you  need  to  have  at
     least one code segment.  This segment should be empty.  Here
     is some sample code that will do the trick:

          .model large
          CODE SEGMENT
          CODE ENDS
          end

     You will need to create an empty .ASM file (give it the same
     name  as your font) and insert this code.    Once  you  have
     created this file, you will need to assemble it using:

          TASM XXXXXXXX.asm

     "XXXXXXXX" should be replaced  with  the  name of your font.
     You have now created the empty code segment module.

The .RC resource script file

     You should create a new file with the extension '.RC'.  Give
     the  file  the  same name as your font.  The  .RC  file  may
     contain as many lines as you  wish.   Here is the format for
     the file:

          1 FONT xxxxxxxx.FNT
          2 FONT yyyyyyyy.FNT
                :
                :






     "xxxxxxxx" and "yyyyyyyy"  are  the names of .FNT font files
     that make up the individual fonts in the font library.

The .DEF module definition file

     The  module  definition  file should be a file with the same
     name as your  font,  with  a  .DEF extension.  The .DEF file
     should look like this:

          LIBRARY        XXXXXXXX
          DESCRIPTION    'FONTRES yyyyyyy'
          STUB           'WINSTUB.EXE'
          DATA           NONE

     "XXXXXXXX"  should  be  the  UPPERCASE  name  of  your  font
     library.  "yyyyyyyy" can be in one of three formats:

         -  aspect, logpixelsx, logpixelsy: comment

         -  CONTINUOUSSCALING: comment

         -  DEVICESPECIFIC devicetypegroup: comment

     See Chapter 18 of the Microsoft Windows Guide to Programming
     book for details on each of these three formats.

Putting it all together: Building the .FON file

     There are essentially to steps to building the finished .FON
     font library file:

        1.  Linking  the  empty   code  segment  module  into  an
            'executable' .FON file

        2.  Adding the actual font resources to the library

     To link the empty code segment module into a .FON  file, you
     can use the following command:

          TLINK -Twd xxxxxxxx.obj, xxxxxxxx.fon,,,xxxxxxxx.def

     "xxxxxxxx" is the name  of  your font library.  Notice the -
     Twd switch, which tells TLINK to form a Dynamic Link Library
     (DLL).  Font libraries are really  just  resource-only DLL's
     (which have no code).

     To  complete  the  .FON  file,  you  must  append  the  font
     resources onto the font library.  This is done with:

          RC xxxxxxxx.rc xxxxxxxx.fon

     "xxxxxxxx" is the name of your font library.

     Congratulations!    You  have  just  built  a  Windows  font
     library.
 
