Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-fonts

Fonts for Luce: native installed faces and paragraph type (CoreText, GDI, cairo) and a portable OpenType engine: sfnt/CFF/WOFF/WOFF2 files, FreeType-exact metrics and outlines, HarfBuzz-style shaping.

A library written in luce-base. Latest release 0.7.2.

Install#

luc add dymokomi/luce-fonts

Documentation#

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

importwhat it holds
import fontsNative font resources, grayscale rasterization and terminal cell widths (cells, text_cells)
import opentypeFont 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 shapingHarfBuzz'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:

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).

Dependencies#

PackageVersion
dymokomi/luce-compressnewest
dymokomi/luce-stdnewest

Versions#

0.7.2

Browse source · pack · commit a671a03ee6f1

SHA-256 2a82b4ae94ef5dab376a7cd047175e17edcd86a0e104635a7a3b85d61ac23271

luce-fonts 0.7.2: batch release

0.7.1

Browse source · pack · commit e037818f7803

SHA-256 76a64ea93a746d4c7c1656d886b99d88ff65dce377eae533ea637a882ad3bb10

dependencies name no version