Skip to content

[WebParagraph] Fix text pixelation, glyph clipping, and snapping offsets to avoid subpixel raster caching - #191736

Merged
auto-submit[bot] merged 25 commits into
flutter:masterfrom
Rusino:fraction
Sep 12, 2026
Merged

auto-submit[bot] merged 25 commits into
flutter:masterfrom
Rusino:fraction

Conversation

@Rusino

@Rusino Rusino commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

This PR improves WebParagraph text rendering quality and caching on CanvasKit:

  1. Fixes text blurriness / fractional distortion: Snaps physical screen offsets to whole integer device pixels and aligns the Canvas2D context translation to integer coordinates. This guarantees a 1:1 physical device pixel blit with FilterQuality.none.
  2. Eliminates glyph clipping: Adds 2 physical pixels of safety antialiasing padding so glyph descenders/ascenders (e.g. g, j, y, _) are no longer clipped at the paint boundary.
  3. Preserves fractional font sizes: Removes .floor() when generating CSS font strings (cssFontSize.toStringAsFixed(2)), allowing fractional font sizes to render accurately.
  4. Simplifies caching (100% cache hit during scrolling): By snapping physical offsets to integer coordinates, text rendered on Canvas2D is always at phase (0.0, 0.0). As a result, the cached bitmap is valid across all translations and scrolling movements. All complex motion heuristics, frame sequence tracking, settle redraws, and 4-bin quantization state machines have been removed in favor of pure scale-based cache invalidation.

Fixes #188323

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WebParagraph] Visual: At certain positions, text looks pixelated and grainy

2 participants