> Ideas.Cacheing

Font_FindFont
-------------

    f9999x9999
    Outlines
    x90y45
    b9999x9999

Thresholds
----------
1. max 4-bpp scaled bitmap size, given master bitmap 30 pixels (24pt at 90 dpi)
2. max 4-bpp scaled outline size (use 1-bpp otherwise)
3. max 4-bpp cached outline size
4. max 1-bpp cached outline size
5. max 1-bpp cached outline size while printing
6. max width of outline font for horizontal subpixel placement
7. max height of outline font for vertical subpixel placement

*  bitmaps always preferred if exact size/bpp found
*  threshold (1) chooses between 4-bpp scaled bitmaps and outlines
*  threshold (2) chooses between 4-bpp outlines and 1-bpp (bitmaps/outlines)
*  thresholds (3),(4),(5) control cacheing of outlines
*  bitmaps are always cached regardless of their size, if used
*  thresholds (6) and (7) control whether subpixel placement is performed
   if so, 4 versions of each char are generated and stored
   16 versions if horizontal and vertical subpixel placement is done

Cacheing
--------

3 sets of cache pointers:
  1. 4-bpp bitmaps              f9999x9999,x90y45,outlines(4bpp)
  2. 1-bpp bitmaps              b9999x9999,outlines(1bpp)
  3. outlines                   can be used to generate (1) and/or (2)

Cacheing depends on whether the font colour offset is 0 or not (ie. whether a
monochrome font is required).  Note that although 1-bpp bitmaps are preferred
for a monochrome font, and 4-bpp is preferred otherwise, this is not
necessarily what is returned.  However, 4-bpp bitmaps are always cached via
the first array of cache pointers, and 1-bpp bitmaps are always cached via
the second.

Note that at Font_FindFont time, the font manager attempts to determine where
the 4-bpp bitmaps will come from - if none are found, it will try to find the
1-bpp bitmaps, and if neither are found, a "Font not found" error will be
returned.  This is done so that the font bounding box (in pixels) can be
computed immediately, for use by Font_ReadInfo.  Code already exists to allow
the pixel cacheing code not to have to scan the font directory more than once
(the information about which file the master font comes from is stored in the
font header when it is first found).

Font colour offset = 0:
    b9999x9999          if exact size found
    outlines            1-bpp
    <4-bpp bitmaps>     using appropriate thresholds

Font colour offset <> 0:
    f9999x9999          if exact size found
    x90y45              if exact size, or ratio <= threshold (1)
    outlines            4-bpp, if size <= threshold (2)
                        if size > threshold (2) use <1-bpp bitmaps> if poss.
    x90y45              use magnified pixels if size > 1.5 * master size
    <1-bpp bitmaps>

In addition: (NYI)
   If Outlines contains '<font name>' then that font's information is used,
      except for the metrics file
   If x90y45 contains 'f9999x9999' then that file is used as the master for
      4-bpp bitmap scaling

Whenever outlines are used, thresholds (3),(4) or (5) are used (as
appropriate) to determine whether the bitmaps or the outlines are retained in
the cache.  If the bitmaps are retained, then the font painting is done using
them, and if the outlines are retained, the font painting is done by drawing
direct to the screen (if 4-bpp outlines are used, it may be possible to
generate a single intermediate anti-aliased bitmap).

Defaults
--------
  Threshold (1) = 20 pixels (16 point at 90 dpi)
  Threshold (2) = 45 pixels (36 point at 90 dpi)
  Threshold (3) = 90 pixels (72 point at 90 dpi)
  Threshold (4) = 90 pixels (72 point at 90 dpi)
  Threshold (5) = 90 pixels (72 point at 90 dpi)
  Threshold (6) = 0 pixels (off)
  Threshold (7) = 0 pixels (off)

