Skip to content

Support text-indent #545

@dolsup

Description

@dolsup

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:

// We can always line break after an inline box
self.state.mark_line_break_opportunity();

With these settings:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedHelp implementing this feature is welcomed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions