Skip to content

Draft: Make line breaking available outside PangoLayout

Matthias Clasen requested to merge line-breaker into main

This branch addresses #391 (closed)

It does the following things:

  • Split PangoLayout into multiple objects:
    • PangoSimpleLayout, the frontend object, holding layout properties
    • PangoLineBreaker, for doing the core line breaking
    • PangoLine, an immutable, opaque version of PangoLayoutLine
    • PangoLines, for holding positioned lines
    • PangoLineIter, for iterating over PangoLines

I think what I would like to do ultimatively is to drop the current PangoLayout and rename PangoSimpleLayout to PangoLayout. Feature-wise, PangoSimpleLayout covers all that PangoLayout does. There will be some slight api changes and cleanups, but nothing too dramatic:

  • PangoAlignmentMode unifies alignment and justification
  • PangoWrapMode unifies wrapping and single-paragraph-mode
  • spacing was dropped (for now, may come back)
  • all of the api related to formatted output, including editing and cursor positioning, was moved to PangoLines
  • all of the api related to iterating was moved to PangoLineIter
  • PangoLayoutLine was replaced by PangoLine

The main reason for the wrap mode change was to keep the argument list of pango_line_breaker_next_line short, but maybe that isn't right.

The line-spacing factor was reimplemented as just a wrapper around the line-height attribute.

Edited by Matthias Clasen

Merge request reports