nightshade-text 0.57.0

Text shaping, styling, and glyph geometry shared by the nightshade renderer and UI.
Documentation
# nightshade-text


Text shaping, styling, and glyph geometry, built on
[`cosmic-text`](https://crates.io/crates/cosmic-text).

It shapes a string into laid-out glyphs, describes how a run should look, and
holds the slot storage consumers index into. Turning glyph geometry into GPU
buffers is left to the caller.

This is a leaf crate: it depends on no other nightshade crate, so the renderer
and the retained UI can both build on it. Anything else can too, not only the
[nightshade](https://github.com/matthewjberger/nightshade) engine.

```toml
[dependencies]
nightshade-text = "0.57.0"
```

## What lives here


- `text_data`: `TextMesh` and `TextVertex`, the geometry shaping produces, plus
  the `FontKind` and alignment enums that describe a run. Always available.
- `font_engine`: `FontEngine`, owning the font database, the shaping context,
  and the glyph rasterization cache. Four fonts are embedded: Roboto, JetBrains
  Mono, Material Icons, and Lucide.
- `text`: `TextProperties` for styling, `TextCache` for slot storage, and
  `TextState` pairing a cache with a font engine.
- `text_wrapping`: `wrap_text`, re-flowing a string to a width.

Everything here sits on the path from a `&str` to laid-out glyphs. Nothing that
is not on that path belongs here.

## Features


`default = ["shaping"]`

| Feature | What it adds |
|---------|--------------|
| `shaping` | The font engine, wrapping, and `TextState`, over `cosmic-text` |

With `shaping` off, the crate is the geometry and styling types alone, with no
font database and no shaping dependency.

## Examples


```sh
cargo run --example shape   # shape and measure a string, then re-flow it to a width
```

## License


Dual-licensed under MIT or Apache-2.0, at your option.