KernSmith.Fonts.Web
0.17.0
dotnet add package KernSmith.Fonts.Web --version 0.17.0
NuGet\Install-Package KernSmith.Fonts.Web -Version 0.17.0
<PackageReference Include="KernSmith.Fonts.Web" Version="0.17.0" />
<PackageVersion Include="KernSmith.Fonts.Web" Version="0.17.0" />
<PackageReference Include="KernSmith.Fonts.Web" />
paket add KernSmith.Fonts.Web --version 0.17.0
#r "nuget: KernSmith.Fonts.Web, 0.17.0"
#:package KernSmith.Fonts.Web@0.17.0
#addin nuget:?package=KernSmith.Fonts.Web&version=0.17.0
#tool nuget:?package=KernSmith.Fonts.Web&version=0.17.0
KernSmith.Fonts.Web
A web font source for KernSmith. Fetches WOFF fonts from CSS-based font CDNs by parsing @font-face responses.
Overview
WebFontSource implements the core KernSmith.Font.IFontSource abstraction. It fetches a stylesheet from a font CDN (Bunny Fonts, Google Fonts, or any compatible custom endpoint), parses the @font-face rules, and downloads the .woff file for the requested Unicode subset.
This is primarily useful in browser/WASM scenarios (e.g. running KernSmith in Blazor WebAssembly) where there is no filesystem and fonts must be obtained over the network.
Platform: Cross-platform (net8.0, net10.0). Uses HttpClient from the BCL.
Usage
dotnet add package KernSmith.Fonts.Web
using KernSmith;
using KernSmith.Font;
using KernSmith.Fonts.Web;
var source = new WebFontSource(WebFontProvider.BunnyFonts);
byte[] bytes = await source.GetFontAsync("Roboto", weight: 400);
BmFont.RegisterFont("Roboto", bytes);
var result = BmFont.GenerateFromSystem("Roboto", size: 32);
Providers
new WebFontSource(WebFontProvider.BunnyFonts); // privacy-friendly default
new WebFontSource(WebFontProvider.GoogleFonts); // fonts.googleapis.com
new WebFontSource(WebFontProvider.Custom("https://my.cdn/css")); // any compatible endpoint
Subsets and styles
await source.GetFontAsync("Roboto", weight: 700, style: FontStyle.Italic, subset: "latin");
await source.GetFontAsync("Roboto", subset: "cyrillic");
Caching
Fetched fonts are cached in memory (keyed by family + weight + style + subset). Pass a
diskCachePath to also persist across runs (leave it null on WASM):
new WebFontSource(WebFontProvider.BunnyFonts, diskCachePath: "cache/fonts");
Limitations
- WOFF only —
.woff2URLs are ignored because WOFF2 uses Brotli compression, which KernSmith does not yet decode. - No family listing — CSS CDNs do not expose a discovery endpoint, so
ListFamiliesAsyncreturns an empty list.
Build
dotnet build src/KernSmith.Fonts.Web/KernSmith.Fonts.Web.csproj
See the KernSmith repository for full project documentation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.17.0 | 48 | 7/19/2026 |