Install the package set that matches the layer and backend you need.
dotnet add package Pretext
Then import the core namespace:
using Pretext;
Add Pretext plus one or more backends when you want to:
Recommended pairings:
| Host | Packages |
|---|---|
| Windows-native | Pretext + Pretext.DirectWrite |
| Linux-native | Pretext + Pretext.FreeType |
| macOS-native | Pretext + Pretext.CoreText |
| Generic SkiaSharp | Pretext + Pretext.SkiaSharp |
| Uno app | Pretext.Uno |
First-party backend packages:
dotnet add package Pretext.DirectWrite # Windows
dotnet add package Pretext.FreeType # Linux
dotnet add package Pretext.CoreText # macOS
dotnet add package Pretext.SkiaSharp # portable fallback / Skia hosts
The core Pretext package targets:
netstandard2.0net461net6.0net8.0net10.0Pretext.Contracts is available when you want to implement a custom measurement backend instead of using one of the first-party backends.
dotnet add package Pretext.Layout
Import the helper namespace when you want the wrap-metric and obstacle-layout utilities without any Uno dependency:
using Pretext.Layout;
Use Pretext.Layout when you want:
PreparedTextMetricsColumnFlowLayoutObstacleLayoutHelperRectObstacle, CircleObstacle, and Intervaldotnet add package Pretext.Uno
Pretext.Uno depends on Pretext, Pretext.Layout, and the first-party backend packages, so the core engine, helper layer, and host-native/portable backend set are brought in transitively. The companion package itself remains net10.0-desktop. Backend discovery then prefers the native backend for the current OS and falls back to Pretext.SkiaSharp when needed. Import the core namespace and whichever companion namespaces you want:
using Pretext;
using Pretext.Layout;
using Pretext.Uno.Controls;
Use the companion package when you want the reusable Uno-side controls from this repository:
StretchScrollHostUiRenderSchedulerEvery preparation entry point accepts a font string. First-party backends share the same CSS-like parser from Pretext.Contracts:
px, for example 16px700 16px Interitalic or obliqueExamples:
"16px Inter"
"italic 16px Georgia"
"700 18px \"IBM Plex Sans\""
"600 15px system-ui"
Line height is not read from the font string. Pass it separately to Layout or LayoutWithLines.
dotnet build PretextSamples.slnx
dotnet test tests/Pretext.Uno.Tests/Pretext.Uno.Tests.csproj
bash ./pack-packages.sh
The repository now ships two sample hosts plus a shared sample layer:
samples/PretextSamples.Shared for shared sample data, assets, and modelssamples/PretextSamples.Uno for the Uno hostsamples/PretextSamples.MacOS for the native AppKit host using Pretext.CoreText