[perf][LOW] GetLineWidth/ScaleForSize recompute scale + per-glyph HMetrics uncached #57
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics#57
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Subsystem: Font
Location:
implementations/Crafter.Graphics-Font.cpp:61-86Impact: LOW · Effort: Small · Not hot path (focused caret only)
Problem
GetLineWidth/ScaleForSizerecompute scale + per-glyph HMetrics with no advance caching; duplicates the advance pipeline the FontAtlas already pays inEnsure.Proposed fix
Per-Font codepoint -> advanceUnits cache (flat ASCII array or map), rescaled per call.
Correctness caveat
The "reuse
Glyph::advance" suggestion is wrong —Glyph::advanceis baked at fixedkBaseSize, so it is incorrect at any otherfontSize. Cache advance in font units and rescale. Preserve the per-glyph(int)truncation.