Skip to content

Use CoreText run-level font fallback for glyph paths #109

@Weixi779

Description

@Weixi779

Problem Background

I’m an Asian developer and ran into a common headache: CJK text sometimes showed missing glyphs when the requested font didn’t
have them. Looking at the code, we weren’t using CoreText’s per-run fallback, so we relied on brittle, hard-coded font names
that vary by platform/locale.

Repair plan

  • In CGPath+Segment.swift, use the CTFont attached to each CTRun (kCTFontAttributeName) when drawing glyphs; if it’s
    missing, fall back to the requested font.
  • No API changes, just better resilience for mixed scripts and missing-glyph cases across platforms.

Testing

  • Local build succeeds (e.g. SWIFTPM_PACKAGE_CACHE=/tmp/swiftpm-cache swift build --scratch-path /tmp/swiftpm-scratch).
  • Manual CLI renders with CJK SVG content display correctly.

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