ktx-font-0.4.0.0: CHANGELOG.md
# Changelog for `ktx-font`
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.4.0.0 - 2026-12-02
- Added `Codec.Ktx2.Font.Slug` to pack quadratic outlines into curve and band data for the Slug renderer.
Planes are `Box`es in the outline units, which are cap heights for Keid fonts.
The data uses linear indices into 4096-texel rows. Curve runs and band lists may cross rows.
- Added Slug bundles.
`packSlugFont` scales font-unit outlines by the cap height that shaping uses. `bundleSlug` writes the bundle.
The KTX2 image holds the curves as `R16G16B16A16_SFLOAT`.
The `slug-glyphs` entry holds the glyph table, and `slug-bands` the little-endian band values. `slug-version` pins the layout.
- Breaking: `Bundle` gains `slug`, a `SlugBundle` with the glyph table and the band values.
The bands stay zstd-compressed. Renderers can unpack them straight into staging memory.
`loadBundle` accepts Slug bundles and gives them a plane-only `atlas` for shaping.
Its `glyphs` boxes are empty and its `_type` is a placeholder. Don't feed it to MSDF pipelines.
- Breaking: `Layout.Align` gains `AlignJustify`.
`placeText` spreads the slack of wrapped and hyphenated lines over the spaces between their words, in proportion to the space widths.
Leading spaces keep their width. Lines that end a paragraph or a hard break keep their natural spacing.
- `placeText` with the `Optimal` strategy breaks with `ragged` spacing unless it justifies.
Left, centered and right-aligned lines no longer come out wider than the maximum width.
- `PlacedLine.width` is the placed width, including any spread.
- Breaking: `LayoutOptions` gains a strict `overflow` field.
Its `Overflow` comes from `KB.Text.Layout.Break`. `Codec.Ktx2.Font.Layout` re-exports it.
`SplitWords` breaks a word wider than the line between graphemes, as before. `layoutText` keeps it.
`KeepWords` lets the word run past the line instead. Placed at zero width, the text then puts one whole word on each line. Its widest line is the narrowest the text can go.
- Breaking: `PlacedLine` gains `overfull`. It marks a line that runs past the maximum width further than its spacing allows.
`Overflowed` now only marks a line cut where no break was allowed, as in `kb-text-layout` 0.3.
A lone glyph or ligature wider than the line ends like any other line. Check `overfull` to catch it.
- Breaking: `shrinkwrapText` takes an `Overflow` first.
With `KeepWords` it can return more than the given width to fit the widest word.
- Require `kb-text-layout` 0.3.
Its optimal layout no longer counts a paragraph's indentation as space to stretch or shrink.
## 0.3.0.0 - 2026-11-17
- Migrated to `kb-text-shape >= 0.3` and `kb-text-layout >= 0.2`.
The bundled kbts blobs changed format again. Rebuild the `.ktxf` assets.
- Shaping failures throw the `ShapeException` from `kb-text-shape` instead of calling `error`.
- `Layout.shapeText` and the break hyphen shape the text as a single run in the style's font.
A style whose font sat under another one in the stack used to get the tail of its text from the font above.
Even with the font on top, the text could split into two runs and lose a ligature.
`kb-text-layout` measures text the same way. The line breaks now agree with the placed glyphs.
- `Shaping.withFont_` carries the caveats of its `kb-text-shape` counterpart.
A section reaching the end of the input shapes its tail in the font below it.
## 0.2.0.1 - 2026-09-06
- Bring back foldl' import for older base.
## 0.2.0.0 - 2026-09-02
- Requires `kb-text-layout >= 0.1.2.0`, whose emergency breaks stop inside
shaping clusters, so a ligature is never split across lines by `placeText`.
- Migrated to `kb-text-shape >= 0.2.1.0`. The bundled kbts blobs changed
format, so the `.ktxf` assets have to be rebuilt.
- Added the `Codec.Ktx2.Font.Layout` module: multiline layout on top of
`kb-text-layout` with wrapping (greedy or optimal), alignment, and
measurement helpers, all in the same cap-height units as the glyph planes.
* `shapeText` does all the font work once, and the pure `placeText` breaks
and places the result for any width, so resizes don't touch the fonts.
* `layoutTextWith` is the two chained together.
- Added `Shaping.shapeClusters`: shaping along a single pen that keeps the
codepoint index and advance of every glyph. `unsafeShapeClusters` is the same
for callers already holding the locked context.
- `StackContext` gained a `layout` field with the measurement caches.
- The demo now lays out with wrapping: Left/Right adjust the wrap width,
F1 toggles the break strategy.
- Fixed `Cursor.ySign` being applied to the glyph positioning offsets as well as
to the line advance. The glyph planes and the offsets are both Y-up, so only
the line advance follows the sign. `initialCursorDown` now really does advance
the lines downwards, and stacked marks land on the correct side of the glyph.
- Fixed the swapped `PlacedGlyph.glyph` / `PlacedGlyph.plane` haddocks. `glyph`
is the atlas box, `plane` is the screen box.
- `shape` now reads the font metrics while the fonts are known to be alive
instead of leaving the lookup to the caller's laziness.
- `bundleFont` now fails on em-sized layouts from fonts without a cap height
instead of writing infinities into the atlas planes.
- Added the `ktx-font-demo` executable (behind the `executables` flag), an
interactive Brillo viewer for the bundles built from `assets.yaml`.
## 0.1.0.1 - 2026-03-18
- Make plane rescaling depend on `layout.atlas.sizeUnit`.
* 1.0 if already caps-sized, unitsPerEm/capHeight otherwise.
## 0.1.0.0 - 2025-12-30
Initial release.