Package and use fonts
Typography should not depend on a font happening to be installed on the
developer's machine. Put licensed font files beside the app's design package
and declare them in dsp.json so codegen can package the same faces for users.
{
"assets": {
"fonts": [
{
"family": "Example Sans",
"weight": 400,
"style": "normal",
"path": "fonts/ExampleSans-Regular.ttf",
"format": "ttf"
}
]
}
}
Replace these example names with the actual family and file, and verify its
redistribution licence. Codegen verifies the path and emits packaged bytes.
Install the generated AppDesignSystem rather than loading the font again in
each component:
DesktopApp::<AppState, _>::new(App)
.with_design_system::<AppDesignSystem>(DesignMode::Light)
.run()
Use the generated typography tokens inside widgets. Avoid assuming a platform font exists.
Terminal is different: the terminal emulator owns the font used for its cell
grid. Installing a Fission design system cannot change that host setting.
For Static site and SSR output, Fission does not add packaged fonts to CSS by default. Set [web].font_delivery in fission.toml to "external" for cacheable font files or "inline" to embed them as data URLs:
[web]
font_delivery = "external"
"none" is the default. This setting applies to Static site and SSR documents, not the canvas-rendered Web SPA. See the [web] configuration for details.