dymokomi/luce-fonts
Source of release 0.7.2
0.7.2 / README.md
# luce-fonts
Fonts for Luce: native font rasterisation (glyph coverage and metrics from the platform's
text engine), and a portable font engine in pure Luce that reads OpenType, TrueType, CFF,
WOFF and WOFF2 files and shapes text as HarfBuzz does.
## Modules
| import | what it holds |
| --- | --- |
| `import fonts` | Native font resources, grayscale rasterization and terminal cell widths (`cells`, `text_cells`) |
| `import opentype` | Font files without a platform library: faces of sfnt files and collections, cmaps, TrueType and CFF outlines as paths, FreeType/Skia-exact metrics at a size, WOFF and WOFF2 decoding |
| `import shaping` | HarfBuzz's default shaper over `opentype`: GSUB, GPOS and kern, marks, clusters, right-to-left runs |
`docs/FONTS.md` describes the native module, `docs/OPENTYPE.md` the font engine (its API,
limits, Unicode data and oracle tests).
## Using it
Add the dependency to `package.prisma`; the modules keep their short names:
```prisma
def dependency "luce-fonts" {
str owner = "dymokomi"
str version = "^0.1.0"
}
```
## Depends on
- luce-std
- luce-compress (WOFF's zlib tables, WOFF2's Brotli stream)
## Platforms
macOS (CoreText), Windows (GDI), Linux (cairo).
Native libraries it links, by platform (declared in `package.prisma`, linked only when the program reaches code that needs them):
- macos: CoreText, CoreGraphics, CoreFoundation
- windows: gdi32
- linux: cairo
## Tests
`luc test` runs every module's `test` blocks (they read the fonts under `tests/`) and the test programs `tests/native_fonts` (system fonts, no window needed) and `tests/font_boundaries` (no target's assembly names another platform's font API).
## License
MIT or Apache-2.0, at your option. The `opentype` and `shaping` modules come from the Luce
port of Ladybird and are also under its BSD 2-Clause licence (`LICENSE-luce-browser`); they
follow Skia (`LICENSE-skia`), FreeType and HarfBuzz in what they compute. The test fonts carry
their own licences (`tests/fonts/NOTICE`).