question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Hyphenation support in WinUI

See original GitHub issue

Proposal: Hyphenation support in WinUI

WPF had it, the web has it, WinUI needs it. Please add support for soft-hyphens to TextBlocks and other UI elements. Currently words will be either wrapped to a new line at the letter that doesn’t fit anymore, on a whitspace or not at all.

A soft-hyphen is the typographic correct way to indicate an appropriate place in a word to wrap to a new line. So if TextTrimming is set to WrapWholeWords, and if the word contains a unicode soft hypen character (U+00AD, often encoded as ­), this character should be used to split the word on two lines with a hypen at the end of the first line.

I believe good algorithms to determine whether to break at a soft-hypen are well understood and implemented in many projects (including Edge, WPF, Word, etc.).

Rationale

Modern typography features are a major draw for developers to adopt WinUI, lets make sure WinUI is really up to par with other platforms.

This is an increasingly important feature if you take internationalization into account, where texts live independent of the box sizes they occupy in a resource file. Additionally, in certain languages (esp. German) long words are much more common and exacerbate the need for this feature.

Stretch goal

A good follow up to this proposal would be a dictionary or algorithm based “auto-hyphenation” feature like some browsers and Word implement. This is especially important with justified text that is a bit longer (think a newspaper-like slim column text layout).

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Marv51commented, Jul 19, 2023

Keep alive (re #8638)

1reaction
yoshiaskcommented, Feb 3, 2021

I’ve had this problem in one of my projects before, and using a zero-width space does work. WinUI will split the word at the ZWS if it needs to. It doesn’t render a hyphen or anything, but if you just need a line break it’s fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hyphenation | WPF Controls
The RichEditControl can enable or suppress word hyphenation at line breaks. When you load a document, the following scenarios are possible:.
Read more >
Soft hyphens in HTML mode are invisible
Steps to reproduce: 1. Go to http://demos.telerik.com/aspnet-ajax/editor/examples/overview/defaultcs.aspx; 2. Select the HTML view mode; 3.
Read more >
Control hyphenation
Hyphenate text automatically · On the Tools menu, click Hyphenation. · Select the Automatically hyphenate document check box. · In the Hyphenation zone...
Read more >
hyphens - CSS: Cascading Style Sheets - MDN Web Docs
The hyphens CSS property specifies how words should be hyphenated when text wraps across multiple lines. It can prevent hyphenation entirely ...
Read more >
Microsoft Word: End-of-Line Hyphenation - SMA, Inc.
End-of-line hyphenation can save space, especially in page-limited proposals, and Microsoft Word has excellent hyphenation tools.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found