Skip to content

Round BitmapText glyph vertices according to vertexRoundMode - #7401

Open
vtxe02023274 wants to merge 1 commit into
phaserjs:masterfrom
vtxe02023274:bitmaptext-round-vertices
Open

vtxe02023274 wants to merge 1 commit into
phaserjs:masterfrom
vtxe02023274:bitmaptext-round-vertices

Conversation

@vtxe02023274

Copy link
Copy Markdown

This PR

  • Fixes a bug

Describe the changes below:

BitmapText and DynamicBitmapText build their glyph quads themselves and hand them straight to the submitter, so no transformer node runs and willRoundVertices was never checked. Text at fractional positions stayed blurry even with roundPixels: true, while an Image at the same spot was snapped.

This applies the same #OnlyTranslate check the transformers use:

  • BitmapText checks once per object and passes the result to BatchChar, which rounds the quad (new optional roundVertices arg, so existing callers are unaffected)
  • DynamicBitmapText checks per glyph since the display callback can rotate or scale individual glyphs

Tested with the example from the issue at zoom 4 (SwiftShader WebGL). Before, the 4.5 lines are soft. After, BitmapText and DynamicBitmapText at 4.5 are sharp and setVertexRoundMode('off') still renders unrounded.

Added two BatchChar tests for the rounded and unrounded quad. npm run lint fails to load .eslintrc.json with the installed ESLint 10, so I checked style by hand.

Fixes #7397

BitmapText and DynamicBitmapText build their glyph quads directly and skip
the transformer nodes, so willRoundVertices was never checked and text at
fractional positions rendered blurry even with roundPixels enabled.

Fixes phaserjs#7397
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[4.2.1] BitmapText ignores roundPixels / vertexRoundMode, so it renders blurry at fractional positions

1 participant