Skip to content

Keep centered text ink within finite view bounds - #287

Open
Happypig375 wants to merge 3 commits into
masterfrom
fix/issue-174-centered-text-bounds
Open

Keep centered text ink within finite view bounds#287
Happypig375 wants to merge 3 commits into
masterfrom
fix/issue-174-centered-text-bounds

Conversation

@Happypig375

Copy link
Copy Markdown
Collaborator

Summary

  • add an explicit finite-region TextPainter.Draw overload that preserves the region origin while applying caller offsets
  • constrain Uno text layout to the control's content width and route the Uno text view through the finite-region path
  • compute positioned ink bounds for centered text and clamp only overflowing centered ink, while leaving the legacy drawing geometry unchanged
  • cover finite-width wrapping, non-zero origins/offsets, centered overhangs, and the legacy/unbounded contract

Validation

  • CSharpMath.Rendering.Tests.TestTextBounds: 12/12 passed
  • full CSharpMath.Rendering.Tests: 1,238/1,238 passed
  • CSharpMath.Xaml.Uno Release build passed
  • Public API checks passed for Debug and Release
  • scoped formatting verification and git diff --check passed

The production Uno path compiles and is covered below the control boundary. A hosted Uno runtime-control test would require the app-host setup described in Uno's runtime testing documentation, which this repository does not currently contain.

Fixes #174

@github-actions github-actions Bot added the Type/Enhancement A concrete change to CSharpMath behavior or capability. label Aug 30, 2026
@Happypig375 Happypig375 added Type/Bug A reproducible defect in CSharpMath. Area/Rendering Typesetting, measurement, fonts, text layout, and drawing. labels Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area/Rendering Typesetting, measurement, fonts, text layout, and drawing. Type/Bug A reproducible defect in CSharpMath. Type/Enhancement A concrete change to CSharpMath behavior or capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Centered TextView can clip wrapped lines at constrained widths

1 participant