Support `text-indent`
enhancementhelp wanted
Parley doesn't currently have a way to indent the first line of a paragraph (like CSS `text-indent`).
I tried working around this by inserting a zero-height `InlineBox` at the start of the paragraph as a spacer. This mostly works, but the line breaker unconditionally marks a break opportunity after every inline box:
https://github.com/linebender/parley/blob/df7cedc073e0c5b445dc5bd043f95f730b68dba4/parley/src/layout/line_break.rs#L257-L258
With these settings:
```rust
builder.push_default(StyleProperty::OverflowWrap(OverflowWrap::Anywhere));
builder.push_default(StyleProperty::WordBreak(WordBreakStrength::BreakAll));
```
Filling a line with `,` characters causes the `InlineBox` to be orphaned on a line by itself — the text moves to the next line at `x=0` with no indent. (This doesn't happen with `A` characters.)
A native `text_indent` parameter would avoid this problem. Negative values could give hanging indents, useful for list markers.
1 条评论