Skip to content

[Feature Request] Support precise glyph bounds measurement with font fallback #3493

@ReedYu

Description

@ReedYu

Description

Need: Measure text with font fallback support AND get precise glyph bounds (not font metrics).
Current limitations:
·Font.measureText(): Precise bounds ✅ but no font fallback ❌
·Paragraph.getRectsForRange(): Font fallback ✅ but uses fixed font metrics ❌

// "Hello" (no descenders) vs "Typography" (has y, p, g descenders)

Font.measureText("Hello"):       height ≈ 17 (tight to glyphs)
Font.measureText("Typography"):  height ≈ 24 (includes descenders)

Paragraph.getRectsForRange("Hello"):      height ≈ 24 (reserves descender space)
Paragraph.getRectsForRange("Typography"): height ≈ 24 (same as "Hello")

Use case: Single-line multilingual text measurement (e.g., "Hello你好") for UI layouts where precision matters. Need automatic font fallback from English to Chinese fonts, but also need bounds that adapt to actual glyphs, not fixed font metrics.
Thanks! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions