Re: [svgwg] Implementing CSS Text Wrapping in SVG (#942)

@shepazu: Thanks a lot for your response!

Sorry for my line-break obsession.
I see the challenges and on the one hand most devs would certainly be satisfied with any line-breaking capabilities implemented ... On the other hand: if developers are already fundamentally revising the text layout engine anyway. Why not tackle it completely?

### Manual line breaks via `white-space`
Another idea to achieve line-breaks could be taken from Firefox's current implementation respecting `white-space` property.  

The current implementation in Firefox renders line-breaks if:
* `white-space: pre` is applied to the `<text>` element
* a new line is present in markup

This approach has the benefit that it doesn't require a new element such as `<tbreak>`. 
Apart from new lines in markup we can use `&#10;` or `&NewLine`; entities.
Line-height is also respected.  
The downside: it doesn't work well with code prettyfying/minification as it would also respect indentations. 

However, this concept could imho be a suitable candidate for manual line-breaks and gives some hope not *all* browser vendors are reluctant to implement new SVG multiline text features.
Ideally, we had a way to apply this behavior with `white-space: pre-line` so only new lines are respected

See [codepen example](https://codepen.io/herrstrietzel/pen/NPKjRwB)

-- 
GitHub Notification of comment by herrstrietzel
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/942#issuecomment-2557279589 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 20 December 2024 16:03:10 UTC