
Unacceptable limitations in font file format
============================================

        Offset  Size    Meaning
        ------  ----    -------

IntMetrics:
        48      1       n = number of defined characters (allows 255 maximum)
        52      256     character mapping (allows 256 maximum)

                        Kern pairs:
        0       1       second letter of pair
                        (actually requires both letters if index is formed
                        in 8 bits by hashing them)

x90y45:
                        <doesn't matter>

Outlines / f9999x9999 / b9999x9999:

        16      36      8+1 chunk offsets (32 characters per chunk)

    Outlines:
        16+36+2 510     offsets of scaffold data from table start
    Scaffold data:
        0       1       char code of 'base' scaffold entry
        1       1       bit mask allows for 8 scaffold lines only
        2       1       bit mask allows for 8 scaffold lines only
        3       1       bit mask allows for 8 scaffold lines only
        4       1       bit mask allows for 8 scaffold lines only
    Scaffold lines:
        0       2       bits 12..14 = scaffold link index
        2       1       width = 0..253
    Chunk data:
        33*4    1       dependency byte (allows for 8 chunks only)
    Outline char data segment:
        0       1       bits 2..4 = x-scaffold link (allows for 8 only)
                        bits 5..7 = y-scaffold link (allows for 8 only)
    Composite character inclusions:
        0       1       character code of character to include


Proposed extensions
===================

We need an extra parameter - the character code range.

By default this is 0..255, so a 256-character translation table is used and
all character codes are stored in 8 bits.

The new definition is:

IntMetrics:
        50      2       flags:
                        bit 5 set => 32-bit limit on number of chars
        If so:
        52      2       offset from file start to metrics data
        54      2       offset from file start to table (kerns etc)
        56      4       max = maximum character code
        60      n(max+1) tot = actual number of characters defined (byte 48 ignored)
                n(max)*tot = mapping from character code to table index
        rounded to next whole byte before starting on metrics
        where n(x) is the number of bits required to store x in binary.

        Kern pairs:
        0       n(max)  code of first character
                n(max)  code of second character
                        rounded up to the next byte

Outlines:
        6       1       Version number of file format:
                        8: new version
        If so:
        16      4       flag word:
                        bit 0 set => scaffold offsets are 32-bit, else 16-bit
                        bits 0..31 reserved (must be 0)
        20      4       max = maximum character code
        24      4       ms = maximum scaffold index
        24      ((max+31)/32)*4+4  chunk offsets
    Outlines:
        ?       2 or 4  offset to table end
        ?+2or4  max*2or4 offsets of scaffold data from table start
    Scaffold data:
        0       n(max)  char code of 'base' scaffold entry
                ms      bit mask for index 1..ms (max scaffold index)
                ms      bit mask for 
                ms      bit mask allows for 8 scaffold lines only
                ms      bit mask allows for 8 scaffold lines only
    Scaffold lines:
        0       2       bit 12 set => H/V scaffold line
                                      bit 13 clr => 8 bits unsigned
                                      bit 13 set => 16 bits unsigned
                        bit 12 clr => L/R/U/D tangent line
                                      bit 13 clr => L/D-tangent
                                      bit 13 set => R/U-tangent
                        bit 14 set => line is linked:
        If bit 12 set:
                1or2    width (1or2 depends on bit 13)
        If bit 14 set:
                (n(ms)+7)/8   index of parent line
    Chunk data:
        33*4    n*4     list of chunk bases, terminated by -1
    Outline char data segment:

############## drastic changes to compress file size #####################

        0       1       bits 2..4 = x-scaffold link (allows for 8 only)
                        bits 5..7 = y-scaffold link (allows for 8 only)
    Composite character inclusions:
        0       (n(max)+7)/8  character code of character to include

