mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-11 09:34:47 +00:00
Metrics::from_dict decodes up to four streams of a font (its Encoding and ToUnicode CMaps, its program, its /CIDToGIDMap), each within a limit of its own but afresh on every call, so a caller reading many fonts that name one large stream decodes it once per font with no total. Metrics::from_dict_within charges each of those decodes to the caller's DecodeBudget, and past_allowance says when one was left unread because the allowance was spent, so a caller can refuse rather than work from guessed widths, code lengths or meanings. A stream past its own limit is left unread as before and doesn't count as past the allowance. from_dict reads with no total, as before. embedded_sfnt_within, which the editor's font listing shares one allowance across, read the metrics that adapt a program's cmap outside that allowance: their ToUnicode and the program again. It now charges them, skips a composite font before reading its metrics (it never used them), and adapts no copy from metrics read past the allowance. Part of #5755. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY