packages feed

kb-text-layout-0.3.0.0: CHANGELOG.md

# Changelog for `kb-text-layout`

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).

## 0.3.0.0 - 2026-12-01

- Breaking: `LineRange` gets an `overfull` field for a line that runs past the target further than its spacing allows.
  Check it instead of comparing `width` with the target. `justified` optimal layouts shrink some lines past the target on purpose.
- Breaking: `Overflowed` only marks a line cut where no break was allowed, such as between the graphemes of a word.
  A lone atom or grapheme wider than the line now ends like any other line. Check `overfull` to catch it.
- Add `Overflow` with `layoutGreedyWith`, `layoutNextLineRangeWith` and `shrinkwrapWith`. It says what happens to a word wider than the line.
  `SplitWords` breaks it between graphemes, as before. `KeepWords` keeps it whole on an overfull line. Soft hyphens still break it.
  With `KeepWords`, `shrinkwrapWith` can return more than the given width.
- Add `layoutOptimalWith`, taking an `Overflow` and a `Spacing` that says how far spaces may stretch and shrink.
  `justified` lets them shrink by a third, as `layoutOptimal` does. `ragged` never shrinks them.
  Its lines only run past the target to fit a word, atom or glued run wider than the line.
- `layoutOptimal` no longer falls back to greedy layout for the whole text when a word, atom or glued run is wider than the line.
  It puts that piece on lines of its own and keeps the rest optimal.
- Fix `layoutOptimal` resizing the indentation after a hard break or leaving it on a line of its own.
- Fix `layoutOptimal` around atoms. It could drop an atom at the end of a line or end a line with the space before one.
- Fix greedy layout hyphenating a word before an atom when the whole word fits.
- Fix greedy layout adding a blank line after an atom or grapheme wider than the line when a hard break follows.

## 0.2.0.0 - 2026-11-17

- Require kb-text-shape 0.3.
  Shaping failures in `prepare`, `prepareStyled`, `measure`, `charAdvances`, `newStyle` and `newStyleWith` now throw its `ShapeException`.
  A `ContextError` leaves the shaping context unusable, and every `LayoutContext` built over it.
- Add `Face`, a font together with variation axis values and OpenType feature overrides.
  `newStyleWith` makes a style from a face, and `face` makes a plain one from a font.
  `newStyle` still takes a bare font.
- Breaking: `Style.font` is replaced by `Style.face`. Read the font as `style.face.font`.
- Fix measuring in the wrong font when the style's font is not on top of the shaping context's font stack.
  The tail of each shaped text used to take its advances from the font on top.

## 0.1.2.0 - 2026-09-04

- Add `ShapedSpan` for runs with caller-supplied per-codepoint advances.
- Add `prepareWithAdvances`, the single-run shortcut for `ShapedSpan`.
- Export `charAdvances`.
- Replace `MeasuredSegment.graphemeWidths :: [(Int, Float)]` with `graphemes :: [Grapheme]`.
- Fix emergency breaks splitting a shaping cluster or a ligature.

## 0.1.0.2 - 2026-08-28

- Keep leading spaces after a hard break and at the start of the text; only fold them after a soft wrap.
- Leading indentation no longer counts as stretchable space for justification.

## 0.1.0.1 - 2026-08-16

- Fix missing foldl' import.
- Limit min GHC to 9.6

## 0.1.0.0 - 2026-08-15

Initial release.