# UFX font

UFX is a [gr/font] format that where glyphs are stored in the ICN format
[gr/icn].  It's declined into 3 specific formats, UF1 with a single 8x8 sprite,
UF2 with 4 sprites for a 16x16 total, and UF3 with 9 sprites for a 24x24 total.

The unit at gr/font/ufx.fs supports loading and drawing UF1 and UF2 formats.

The UFX file format has 2 section. A first $100 bytes section describe the width
of each glyph, allowing proportional fonts. Each byte is the width in pixel of
the corresponding glyph. Then comes the ICN sprites.

A UF1 file is $900 bytes long, UF2, $2100, UF3, $4900.

For UF2 and UF3, sprites are arranged in this order:

  0 2   0 3 6
  1 3   1 4 7
        2 5 8

The height of a font isn't specified in the file per se, it has to be computed.
In Dusk, we consider that the letter "g" is always "grounded", that is, touches
the lowest possible point, so we use this letter to figure out the height of a
UFX font.

Using the maximum height of all glyphs is problematic because some fonts may
contain outliers that mess the whole computation and makes height higher than it
should.

## API

### Fields

widths  Points to array of $100 bytes describing glyph widths
glyphs  Points to ICN array

### Words

loaduf1
loaduf2 ( path -- font )
  Open and read "path" containing a UF1/UF2 font in memory, yielding a [gr/font]
  structure.

drawuf1
drawuf2 ( color0 color1 c font -- )
  UF1/UF2 implementation of [gr/font] "draw" method.
