Repository navigation
Fix FontFile equality so identical fonts compare equal - #1204
Open
creat3dworld wants to merge 1 commit into
Open
creat3dworld wants to merge 1 commit into
creat3dworld wants to merge 1 commit into
Conversation
Open
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1009
Root cause
On macOS, bold/italic variants live as different faces inside one .ttc collection (e.g. Helvetica.ttc index 0 Regular, 1 Bold, 2 Oblique, 3 BoldOblique);
WxFontUtils::set_bold()/set_italic()load the file again but nothing setsFontProp::collection_number, so index 0 is always rendered. Two related defects: (a)Emboss::FontFile::operator==compares descent/linegap with==instead of!=, so identical font files are never detected and the synthetic bold/skew fallback never fires; (b) after reload, wxWidgets reports the bold/italic font as "normal" style/weight, so button states are wrong.Fix (partial)
Defect (a) is verified in source (
Emboss.hpp:infos[i].descent == other.infos[i].descent || infos[i].linegap == other.infos[i].linegap— with==, equal descent/linegap makes the condition true and returns false, so identical fonts are never equal). Fixed to!=. This is a clear, cross-platform correctness fix (inherited from PrusaSlicer).The main .ttc defect (collection_number never set from the OS-resolved face index) is NOT fixed here — it needs the reporter's macOS Core Text fix (resolve the face index the OS selected and store it in
collection_number, plus restoring style/weight from the matched font), which the reporter says they tested and will PR. No open PR for #1009 was found on this repo, so the reporter's PR has not landed yet. This operator== patch is a subset of their fix; if their PR lands first, this one can be dropped in favour of it.Based on the v2.4.1 tag. Upstream main has moved 25 commits ahead of v2.4.1; this branch is based on v2.4.1, and the files it touches were not changed on main since v2.4.1, so it should merge cleanly.
Verification: the patch was verified to apply cleanly to a fresh v2.4.1 copy (dry-run + byte-compare). It was NOT compile-tested — this VM has no build toolchain for OrcaSlicer.