Multi-channel SDF font rendering & basic text layout for WebGL
npm install @thi.ng/webgl-msdf
!npm downloads

> [!NOTE]
> This is one of 214 standalone projects, maintained as part
> of the @thi.ng/umbrella monorepo
> and anti-framework.
>
> 🚀 Please help me to work full-time on these projects by sponsoring me on
> GitHub. Thank you! ❤️
- About
- Status
- Installation
- Dependencies
- Usage examples
- API
- Authors
- License
Multi-channel SDF font rendering & basic text layout for WebGL. This is a support package for @thi.ng/webgl.
This package provides multi-channel SDF font
rendering capabilities for
@thi.ng/webgl,
incl. optional support for basic text alignment, vertex colors (e.g. for
multi-color text), and shader options to draw outlines for each
character. Furthermore, the key GLSL functions are provided as shader
snippets to embed this functionality in custom shaders without having to
resort to copy & paste.
There're different versions of MSDF font generators. The format
supported by this module is based on Don
McCurdy's.
STABLE - used in production
Search or submit any issues for this package
``bash`
yarn add @thi.ng/webgl-msdf
ESM import:
`ts`
import * as wm from "@thi.ng/webgl-msdf";
Browser ESM import:
`html`
Package sizes (brotli'd, pre-treeshake): ESM: 1.57 KB
- @thi.ng/api
- @thi.ng/shader-ast
- @thi.ng/transducers
- @thi.ng/vector-pools
- @thi.ng/vectors
- @thi.ng/webgl
Note: @thi.ng/api is in _most_ cases a type-only import (not used at runtime)
One project in this repo's
/examples
directory is using this package:
| Screenshot | Description | Live demo | Source |
|:------------------------------------------------------------------------------------------------------------------|:--------------------------------------------|:-------------------------------------------------|:------------------------------------------------------------------------------|
|
| WebGL MSDF text rendering & particle system | Demo | Source |
TODO
If this project contributes to an academic publication, please cite it as:
`bibtex``
@misc{thing-webgl-msdf,
title = "@thi.ng/webgl-msdf",
author = "Karsten Schmidt",
note = "https://thi.ng/webgl-msdf",
year = 2019
}
© 2019 - 2026 Karsten Schmidt // Apache License 2.0