Skip to content

Halo (Style.HaloWidth) spikes at acute glyph corners, default miter join #113

Description

@vchelaru

Style.HaloWidth spikes badly at acute glyph corners (V, W, Y, A, K, 1, ! etc), worse as halo width grows relative to font size. At larger widths the spike can end up roughly as tall as the glyph itself.

Screenshot (halo=8, sizes 8/16/32/64, same spike at every size):

Image

Root cause looks like FontRun.Paint() building paintHalo as a stroke paint but never setting StrokeJoin:

https://github.com/toptensoftware/RichTextKit/blob/master/Topten.RichTextKit/FontRun.cs#L626-L652

That leaves it on Skia's default Miter join, which is unbounded until the default miter limit (~4x half the stroke width) kicks in, exactly what produces the long spikes on acute corners.

Repro: any text with HaloWidth around 8+ at a normal UI font size (16-32px), any font with reasonably sharp vertices (plain Arial reproduces it).

Fix is probably a one-liner, setting paintHalo.StrokeJoin = SKStrokeJoin.Round next to the rest of the paint setup around line 648. Round join is what most other text-outline implementations use (browser -webkit-text-stroke, Unity TextMeshPro) for this exact reason. Happy to send a PR if that's the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions