Skip to content

[web] Render soft hyphens on CanvasKit - #194339

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
dbebawy:soft-hyphen-canvaskit-193506
Oct 16, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
dbebawy:soft-hyphen-canvaskit-193506

Conversation

@dbebawy

@dbebawy dbebawy commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Makes Hyphens work on the CanvasKit renderer, following #193850 for Skwasm.

CanvasKit's ParagraphStyle gained renderSoftHyphens in Skia (https://skia-review.googlesource.com/c/skia/+/1378836), which rolled into Flutter with #193884. CkParagraphStyle now sets it the same way the native engine and Skwasm do: soft hyphens render at a line break unless Hyphens.hidden is set. Because CanvasKit is the default renderer for flutter build web, text containing U+00AD in most web apps now shows a hyphen at soft-hyphen line breaks, matching native and Skwasm. This also covers a --wasm app that falls back to CanvasKit.

With both web renderers supported, the hyphen tests in paragraph_builder_test.dart and the TextPainter hyphen tests no longer skip on the web, and the TextPainter.hyphens docs drop the web caveat. WebParagraph, which is experimental and off by default, still ignores hyphens; its TODO stays on #193506.

Part of #193506.

Pre-launch Checklist

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. engine flutter/engine related. See also e: labels. platform-web Web applications specifically team-web Owned by Web platform team labels Oct 14, 2026
CanvasKit's ParagraphStyle gained renderSoftHyphens in Skia 327c15e8176e,
which rolled in with flutter#193884. Set it the same way the native engine does:
render the hyphen unless hyphens is Hyphens.hidden.

The hyphen tests now run on every web renderer, and the TextPainter.hyphens
docs no longer need a web caveat.
@dbebawy
dbebawy force-pushed the soft-hyphen-canvaskit-193506 branch from 8a9407f to 6145a21 Compare October 15, 2026 18:29
@dbebawy
dbebawy marked this pull request as ready for review October 15, 2026 21:04
@dbebawy

dbebawy commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

@mdebbar This is the CanvasKit follow-up to #193850, now rebased onto master. Could you take a look, and could someone add the CICD label?

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enables support for soft hyphens in the CanvasKit renderer by exposing and setting the renderSoftHyphens property on SkParagraphStyleProperties. It also updates the documentation to reflect this support and enables previously skipped tests for hyphens on CanvasKit. There are no review comments, so no feedback is provided.

@mdebbar mdebbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mdebbar

mdebbar commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

@LongCatIsLooong wanna check this one as well? Thanks!

suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
Makes `Hyphens` work on the CanvasKit renderer, following flutter#193850 for
Skwasm.

CanvasKit's `ParagraphStyle` gained `renderSoftHyphens` in Skia
(https://skia-review.googlesource.com/c/skia/+/1378836), which rolled
into Flutter with flutter#193884. `CkParagraphStyle` now sets it the same way
the native engine and Skwasm do: soft hyphens render at a line break
unless `Hyphens.hidden` is set. Because CanvasKit is the default
renderer for `flutter build web`, text containing U+00AD in most web
apps now shows a hyphen at soft-hyphen line breaks, matching native and
Skwasm. This also covers a `--wasm` app that falls back to CanvasKit.

With both web renderers supported, the hyphen tests in
`paragraph_builder_test.dart` and the `TextPainter` hyphen tests no
longer skip on the web, and the `TextPainter.hyphens` docs drop the web
caveat. WebParagraph, which is experimental and off by default, still
ignores `hyphens`; its TODO stays on flutter#193506.

Part of flutter#193506.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant in-code documentation (doc comments with
`///`).
- [ ] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD engine flutter/engine related. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. platform-web Web applications specifically team-web Owned by Web platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants