Skip to content

[iOS] WebGPU renderer draws the plain glyphs of a COLR font black #26670

Backlog

Description

@mikernet

Current behavior 🐛

On iOS with the WebGPU renderer, every glyph of a font that has a COLR table draws black, whatever the text's Foreground, including the glyphs that have no colour layers. For example, with an icon font that has a few COLR colour icons, all of its monochrome icons draw black. The same text draws correctly with the Skia renderer, and on other platforms.

Expected behavior 🎯

Glyphs without colour layers fill with the text's foreground, and COLR glyphs draw in colour.

Cause

Skia's CoreText scaler treats the font's colour-glyphs trait, which CoreText sets for the whole font when it has COLR, as applying to every glyph (neverRequestPath is set from it in SkScalerContext_Mac), so SKFont.GetGlyphPath gives no path for any glyph of such a font. SkiaFont.BuildGlyphRun takes an empty outline in a font with colour glyphs to mean a colour glyph, and sends it to RasterizeColorGlyph, which paints the glyph image with a default (black) SKPaint.

DirectWrite and FreeType give outlines for the plain glyphs of a COLR font, so other platforms are unaffected. The Skia renderer draws text through SKCanvas, not through BuildGlyphRun, so its text draws correctly.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Add a font with a COLR table and some plain glyphs to an app's assets (a test font: src/Uno.UI.RuntimeTests/Assets/Fonts/colr-mixed-glyphs.ttf in the linked PR; glyphs U+E000 and U+E001 are plain, U+E002 and U+E003 are COLR v0 and v1).
  2. Show its plain glyphs with a coloured foreground, e.g. <FontIcon FontFamily="ms-appx:///Assets/Fonts/colr-mixed-glyphs.ttf#COLR Mixed Glyphs" Glyph="&#xE000;" Foreground="White" />.
  3. Run on iOS with .GraphicsBackend(WebGpuBackend.CreateGraphicsProvider()) before the Skia backend.

The plain glyph draws black instead of white.

Workaround 🛠️

Use the Skia renderer on Apple platforms, or remove the COLR and CPAL tables from the font.

Affected platforms 📱💻🖥️

iOS. Verified on the iOS 27 simulator and on an iPhone. macOS and Mac Catalyst use the same CoreText scaler, so they should be affected too with the WebGPU renderer (not verified).

Uno.Sdk version (and other relevant versions) 📦

Uno 7 (master at 8d282b1), WebGPU renderer.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions