Repository navigation
test(render): compare extent number centres across fonts - #3614
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| let mut p = tiny_skia::Point::zero(); | ||
| // Different digits need not have the same advance (notably in Windows' | ||
| // default font). Their pen starts differ even when their centres coincide. | ||
| let last = run.glyphs.last().unwrap(); |
There was a problem hiding this comment.
run.glyphs.last().unwrap() panics without saying which run was empty. Test code may unwrap (clippy.toml allows it), so this is not a rule break. Skipping an empty run keeps the failure in the assertion instead:
| let last = run.glyphs.last().unwrap(); | |
| let Some(last) = run.glyphs.last() else { continue }; | |
| let width = last.x + run.font.h_advance_unscaled(last.id) * run.size / run.font.units_per_em().unwrap(); |
Category: quality
There was a problem hiding this comment.
Left for the release quality pass: this improves the diagnostic for an unexpected empty glyph run in the test helper. It does not affect the centre measurement fix.
Code reviewScope: one test-only file, Bugs
Security
Performance
Quality
AGENTS.md
Already raised: none. Change sizeCompared with
|
|
The ci:macos and ci:windows labels are already set. The 8-pixel checks remain approximate placement checks and include the baseline's vertical offset; the coincidence checks use the separate 0.001-pixel tolerance. All 27 extent tests passed locally with both font configurations, and the fork's Windows x64/ARM suites passed. Tightening the broader placement bounds and aligning the remaining terminology are left for the release quality pass, along with the inline diagnostic suggestion. |
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
Summary
Five extent-number placement tests fail with the default Windows and macOS fonts because their shared helper records each number's pen start while the assertions compare centres. Digits with different advances have different pen starts even when the renderer centres them at the same place.
Measure the horizontal centre from the recorded glyph advances before applying the page transform. Compare coincident positions within 0.001 page pixels to allow f32 round-off; the original font-dependent errors are about 0.8–1 pixel. This changes only test measurements and assertions, with no rendering or application behaviour change.
Testing
RUSTGIS_BUILTIN_FONTS=1(0.11 s and 0.19 s).UI evidence
No visible UI change.
Related issue
Follow-up to #3571. The same failures block #2931, #3016 and the nightly build.
Summary by CodeRabbit