Constant tfm::pl::MAX_LIG_KERN_INSTRUCTIONS
source · pub const MAX_LIG_KERN_INSTRUCTIONS: u16 = _; // 32_510u16
Expand description
Maximum number of lig/kern instructions in a property list file.
This limit is defined without explanation in PLtoTF.2014.3. Here’s an explanation for the specific value.
First, in a TFM file the sub-file sizes, including the number of lig/kern instructions nl
,
are 8-bit integers in the range [0, i16::MAX]
.
(I don’t know why the range is restricted like this, maybe for portability.)
Thus the maximum number of lig/kern instructions is less than or equal to i16::MAX
.
Second, after a PL file is read some additional instructions may need to be prepended to support LABEL entries with an index larger than u8::MAX. This is the “embarrassing problem” described in PLtoTF.2014.138. In TFM files the index for the starting lig/kern instruction for a character is a u8. To support higher indices, a special lig/kern instruction is prepended to the list of instructions. This instruction specifies where to actually start. The payload for this instruction supports 16-bit integers.
There are 257 possible characters (the usual 256 plus the boundary character),
and thus we may need to insert up to 257 additional instructions.
After this we still need to be under the i16::MAX limit
.
So the limit is i16::MAX - 257
.