Skip to content

Support customizing the soft-hyphen character/string #189617

Description

@dbebawy

Follow-up from #185152 (soft-hyphen rendering, part of #18443).

The Hyphens API added in #185152 controls whether the default hyphen glyph (-) is rendered at a soft-hyphen (U+00AD) line break (Hyphens.manual vs Hyphens.hidden). A separate enhancement is to let callers customize the hyphen character/string itself (e.g. a different dash, or a language-specific hyphenation mark).

This is being prototyped upstream in skparagraph: https://skia-review.googlesource.com/c/skia/+/1205922. Once that lands and a binding is exposed, Flutter could add a hyphenCharacter-style API on ParagraphStyle/TextStyle.

Tracking this separately from #18443, which tracks rendering the default hyphen. Raised in review of #185152 by @Renzo-Olivares.

Activity

  1. added
    in triagePresently being triaged by the triage team
    c: new featureNothing broken; request for a new capability
    c: proposalA detailed proposal for a change to Flutter
    frameworkflutter/packages/flutter repository. See also f: labels.
    engineflutter/engine related. See also e: labels.
    a: typographyText rendering, possibly libtxt
    fyi-frameworkFor the attention of Framework team
    and removed
    in triagePresently being triaged by the triage team
    on Jul 17, 2026
  2. added
    P2Important issues not at the top of the work list
    on Jul 20, 2026
  3. 8 remaining items

  4. Renzo-Olivares commented on Oct 15, 2026

    @Renzo-Olivares
    Contributor

    @dbebawy That approach sounds good to me, though curious if @LongCatIsLooong had any thoughts. Maybe we should hold off on this customization until #189234 is fixed?

  5. dbebawy commented on Oct 21, 2026

    @dbebawy
    ContributorAuthor

    @Renzo-Olivares #189234 is fixed now. The Skia change (https://skia-review.googlesource.com/c/skia/+/1396916) has been in master since Oct 20. It also handles custom hyphen strings, so the drawn hyphen is selected together with its soft hyphen whatever the string is. Skia now also leaves room for the hyphen when breaking lines (#194582), using the custom string's width.

    So I think this is unblocked. I'll start on the hyphenCharacter API unless @LongCatIsLooong would prefer a different shape.

  6. dbebawy commented on Oct 24, 2026

    @dbebawy
    ContributorAuthor

    @LongCatIsLooong Julia assigned this to me, so here is the shape I plan to use before I start:

    • String? hyphenCharacter on ui.ParagraphStyle, TextPainter, RenderParagraph, RichText and Text, the same way as hyphens. null keeps the default hyphen, and the framework asserts that it is not empty, since Hyphens.hidden already covers drawing nothing.
    • It reaches the paragraph through one more TextStyle.getParagraphStyle parameter. That breaks classes that override getParagraphStyle again, one release after hyphens did, so it would come with a migration guide.
    • Skia lays out the string as a single run, so the docs will recommend a short string, usually one character, that the text's font supports.

    Is that OK, in particular the second getParagraphStyle parameter?

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

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: typographyText rendering, possibly libtxtc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterengineflutter/engine related. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.team-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions