Skip to content

Float positioning "as high as possible" prohibits non-greedy line-breaking #3756

@gsnedders

Description

@gsnedders

From https://news.ycombinator.com/item?id=19473277:

[Doing better line breaking in web browsers] comes up on every thread related to web typography, and the answer as always is that it's not possible in the general case, at least not with the specs as they are today. The biggest problem is that the CSS specification demands that a float be placed as high as possible (CSS 2.1 section 9.5.1, rule 8 1). But float ceilings can be anywhere in the middle of a paragraph. By its nature, Knuth line breaking means that any particular unit (word), and therefore any float ceiling, might not be as high as possible. In fact, the only algorithm that can be used in this case to satisfy the spec is the greedy one. Therefore, Knuth line breaking cannot be used on the Web.

It might be possible to use Knuth line breaking in specific circumstances, such as when paragraphs have no floats. But not in general.

If I'm not mistaken, Prince doesn't do this, and I'm dubious that this is the intention of the "as high as possible" rule. Quite how we should phrase the rule if we want to loosen this is a… harder question.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions