mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-24 10:08:00 -06:00
* M7: keep embedded CMap ranges compact instead of truncating expansion A ToUnicode CMap's sequential bfrange used to expand into one HashMap entry per code, and the parser stopped at 2^20 expanded codes. A valid CMap with more codes than that lost every mapping past the cap. Each sequential range is now one record. Codes below 65 536 find their covering record in a table, higher codes by binary search over a cover index; the later declaration wins where ranges and explicit entries overlap. Explicit entries keep their strings. The budget counts an explicit entry as one and a range as two, since a range covers at least two codes, so every CMap with at most 2^20 codes is kept whole. encode finds the lowest code per character from the same records. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> * ToUnicode: size the low-code tables to the codes a font covers --------- Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>