Skip to content
LokadPublic

About

Managed .NET SVG-to-PNG renderer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Lokad.Svg

Lokad.Svg is a pure-managed library for .NET 10 and .NET 11 that converts a documented subset of static SVG to PNG on Windows and Linux, with no runtime package dependencies. The .NET 11 target currently uses the pinned RC SDK/runtime. It supports affine geometry and local instances, gradients and patterns, clips and masks, embedded PNGs, static CSS, markers, selected filters and supplied-font labels/text paths. See supported SVG for the exact boundaries and unsupported outcomes.

Install Lokad.Svg from NuGet:

dotnet add package Lokad.Svg --version 0.4.0

CHANGELOG records release notes.

SvgConverter provides synchronous and asynchronous output to independently owned memory, caller memory or a writable stream. SvgPreparedDocument supports explicit preparation and one conversion. Fonts use an explicit catalog and fallback policy, with ordered CSS family lists and caller-defined generic mappings; ordinary conversion does not discover machine fonts or fetch resources. The opt-in HTTP font-pack resolver supplies host-configured acquisition and caching, with shared memory admission and disposable PNG results. Font-selected fitting/scanning and pair kerning follow the documented subset. Size and structural limits, cancellation and borrowed-storage lifetimes apply throughout. SvgRenderOptions.WithMemoryBudget borrows the host's shared allowance; convenience calls without it are ungoverned. Use ConvertToOwnedPng/ConvertToOwnedPngAsync for governed retained output, and dispose the result after readers finish. Caller-memory and stream output borrow their destinations. Memory accounting follows the resource policy.

Qualification covers the 26 upstream documents and focused regressions against frozen Windows/Linux references, plus package and installed-consumer checks. These results establish the declared outputs, not general SVG completeness. See qualification for font evidence and host-specific deployment checks.

Development

Use the .NET 11 RC SDK pinned in global.json. Install the .NET 10 SDK/runtime alongside it for compatibility and installed-package checks. Builds, tests and tools default to .NET 11; the library package includes both targets. See test selections for explicit .NET 10 and full release runs.

dotnet restore --locked-mode
dotnet build -c Release
dotnet test -c Release
dotnet pack src/Lokad.Svg/Lokad.Svg.csproj -c Release

Packages are written to artifacts/nuget/. Non-Release packaging is rejected unless explicitly enabled for troubleshooting.

Tests, browser tooling and benchmarks are used only for development.

On the dedicated quiet benchmark VM, run allocation and throughput benchmarks with:

dotnet run -c Release --framework net11.0 --project benchmarks/Lokad.Svg.Benchmarks

BENCHMARKS describes workloads and measurement conditions. RASTERIZATION_DESIGN explains the renderer; Tests and provenance describes regression collections and admission.

Diagnostic tools

After a Release build, run the resource, font-host and package smoke checks with:

tools/test-memory-probe.ps1 -ResultsDirectory artifacts/memory-probe
tools/test-font-probe.ps1 -ResultsDirectory artifacts/font-probe-smoke
tools/test-package.ps1 -PackageDirectory artifacts/nuget -ResultsDirectory artifacts/package-smoke

For an isolated conversion and optional budget/cancellation controls:

dotnet run -c Release --framework net11.0 --project tools/Lokad.Svg.MemoryProbe -- tests/Fixtures/original/solid-red.svg artifacts/probe.png --memory-budget-bytes 1048576

FontProbe documents explicit local/HTTP font sources. Endpoints, credentials, caches and transport remain host-owned; ordinary builds and CI require no private configuration. The tools guide documents reference capture, research probes and pixel comparison. Keep generated diagnostic output under the ignored artifacts/ tree.

About

Managed .NET SVG-to-PNG renderer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages