Repository navigation
fix: DrawTextOnPath renders tofu square between words in street labels - #3354
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DrawTextOnPathwas passing text throughTransformText, which callsBreakTextto insert\ncharacters at word boundaries for long labels. SinceDrawTextOnPathis a single-line rendering call, Skia has no glyph for\nand renders it as a tofu square (□) — visible, for example, in Russian road names like "СТАДИОННАЯ УЛИЦА".Fixes #3346
Root cause
TransformTextwas shared by bothDrawText(point labels) andDrawTextOnPath(road labels). For point labels, the\n-based word-wrapping is correct —DrawTextsplits on\nand 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 awordWrapparameter (defaulttrue). Whenfalse, only case transforms (uppercase/lowercase) are applied;BreakTextis skipped entirely.DrawTextOnPath— now callsTransformText(..., wordWrap: false), so no\nis ever produced for path text.Assembly.cs(new) — exposes internals to the test project viaInternalsVisibleTo.Tests/Mapsui.Experimental.VectorTiles.Tests(new project) — unit tests forSkiaCanvas.TransformTextcovering: no\nwhenwordWrap: false, text preserved, uppercase/lowercase transforms, and empty-text edge case..gitignore— added*.tmpto suppress MSBuild SDK resolver backup files.