Keep the hot spend primitive always-inline and branch-free. Budget costs
and multipliers are unsigned and structurally bounded by their callers, so
the primitive only needs to debit the live counter and report exhaustion.
Move hb-limits.hh alongside the shared internal headers, after the paired
inline/noinline attribute definitions it now depends on.
Tests: meson test -C build (272/272 passed)
Assisted-by: OpenAI Codex <codex@openai.com>
COLR can repeatedly request expensive glyf or CFF outlines, multiplying
their per-glyph structural limits. Make both outline implementations
consume a caller-provided weighted budget so a later paint-session
counter can aggregate that work.
Add checked precharge arithmetic with stable exhaustion, charge glyf
loads, terminal points, and gvar tuples, and charge CFF operators,
subroutine calls, CFF2 blends, and both CFF1 seac outlines. Keep a
generous local fallback for callers that do not yet provide a session
budget.
Tests: meson test -C build
Assisted-by: Codex <codex@openai.com>
Provide an always-inline int64_t overload of hb_clamp_to for cold
position formulas that need wider intermediate arithmetic while
preserving integer division and rounding semantics.
Add boundary tests. This supports the complete position-overflow fix
for issue #6151.
Testing: meson test -C build --print-errorlogs
Assisted-by: Codex <codex@openai.com>
Add an always-inline saturating negation for position values that can
reach INT_MIN. Also require the floating-point clamp helper to inline,
matching the add and subtract helpers used throughout shaping.
Extend the boundary tests for both helpers. This supports the complete
position-overflow fix for issue #6151.
Testing: meson test -C build --print-errorlogs
Assisted-by: Codex <codex@openai.com>
Provide always-inline signed add and subtract helpers for position
arithmetic. Compiler overflow builtins reduce the common path to one
arithmetic instruction and a not-taken overflow branch.
This is the foundation for fixing the position overflow reported in
issue #6151.
Assisted-by: Codex <codex@openai.com>