Skip to main content

allocation_order

Function allocation_order 

Source
fn allocation_order() -> impl Iterator<Item = u8>
Expand description

Preferred slot-allocation order: the six WinAnsi gap bytes first (predictable golden output for ≤ 6 extended glyphs), then 0xFF..=0x20 descending excluding those same six bytes. We deliberately skip 0x00..=0x1F: PDF readers tolerate control bytes in /Differences, but content streams that need an Str(...) literal can run afoul of \0/\r/\n escaping, and using high-byte slots first keeps short paragraphs from perturbing low-byte slots.

The gap-exclusion in the descending tail is load-bearing: without it the gap bytes would appear twice in the iterator (once at the front, once again at their natural position 0x7F/0x81/…/0x9D), and the planner, which doesn’t re-check claimed[slot] after pop, would allocate the same byte to two different extended chars once extended.len() grew past ~104. Today the AGL subset has only ~99 entries so this latent bug couldn’t fire, but it’s wrong on principle. See differences_have_unique_slots for the regression guard.