Skip to content

fix: DrawTextOnPath renders tofu square between words in street labels - #3354

Merged
pauldendulk merged 3 commits into
mainfrom
fix_tofu_in_vector_tiles
May 18, 2026
Merged

pauldendulk merged 3 commits into
mainfrom
fix_tofu_in_vector_tiles

Conversation

@pauldendulk

Copy link
Copy Markdown
Member

Problem

DrawTextOnPath was passing text through TransformText, which calls BreakText to insert \n characters at word boundaries for long labels. Since DrawTextOnPath is a single-line rendering call, Skia has no glyph for \n and renders it as a tofu square (□) — visible, for example, in Russian road names like "СТАДИОННАЯ УЛИЦА".

Fixes #3346

Root cause

TransformText was shared by both DrawText (point labels) and DrawTextOnPath (road labels). For point labels, the \n-based word-wrapping is correct — DrawText splits on \n and renders each line with a vertical offset. For path labels, the wrapping is both unnecessary (a path-length guard already skips labels that are too long) and harmful.

Changes

  • SkiaCanvas.TransformText — added a wordWrap parameter (default true). When false, only case transforms (uppercase/lowercase) are applied; BreakText is skipped entirely.
  • DrawTextOnPath — now calls TransformText(..., wordWrap: false), so no \n is ever produced for path text.
  • Assembly.cs (new) — exposes internals to the test project via InternalsVisibleTo.
  • Tests/Mapsui.Experimental.VectorTiles.Tests (new project) — unit tests for SkiaCanvas.TransformText covering: no \n when wordWrap: false, text preserved, uppercase/lowercase transforms, and empty-text edge case.
  • .gitignore — added *.tmp to suppress MSBuild SDK resolver backup files.

@pauldendulk pauldendulk added the PR type: 🐛 Fix A bug fix or patch for existing functionality. label May 18, 2026
@pauldendulk
pauldendulk merged commit 64ac3c0 into main May 18, 2026
4 checks passed
@pauldendulk
pauldendulk deleted the fix_tofu_in_vector_tiles branch May 18, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR type: 🐛 Fix A bug fix or patch for existing functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DrawTextOnPath renders a tofu square (□) between words in street labels

1 participant