Make FrameUtil.ApplyFont lazy - #109
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2394cc044
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR optimizes FrameUtil.ApplyFont by making font/shadow application “lazy”, avoiding redundant SetFont, SetShadowColor, and SetShadowOffset calls when the resolved settings haven’t changed. This targets hot refresh paths (bars/icons) to reduce per-refresh work.
Changes:
- Added
fontMatches/shadowMatcheshelpers and early-exit logic inFrameUtil.ApplyFontto skip redundant setter calls. - Introduced per-fontstring caching (
__ecmFont*) as a fallback when live getters aren’t available. - Added a new unit test verifying repeated calls don’t reapply unchanged font settings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| FrameUtil.lua | Adds lazy font/shadow matching and skips redundant setter calls in ApplyFont. |
| Tests/Utilities_spec.lua | Adds coverage ensuring repeated ApplyFont calls don’t repeatedly call setters for unchanged settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot resolve |
Added a second test that enables |
724b7a2 to
2d575b4
Compare
FrameUtil.ApplyFontruns on hot bar/icon refresh paths (power/aura updates, extra icon cooldown refreshes) and reapplied identicalSetFont/SetShadowColor/SetShadowOffseton every call.Changes
fontMatches/shadowMatchescompare resolved settings against live FontString state and short-circuit redundant setter calls.GetFont/GetShadowOffset/GetShadowColordirectly — noif fontString.GetX thenguards, no__ecmFont*shadow cache that could drift from live UI state.0,0.Notes
Because a fresh FontString already sits at the
0,0no-shadow default, the lazy path correctly skips the redundantSetShadowOffset(0,0); affected tests now assert effective state rather than setter call counts. Added coverage for the shadow-enabled path (SetShadowColor/SetShadowOffsetapplied once across repeated calls).