Meziantou.Framework.VectorGraphics 1.0.1

Prefix Reserved
dotnet add package Meziantou.Framework.VectorGraphics --version 1.0.1
                    
NuGet\Install-Package Meziantou.Framework.VectorGraphics -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Meziantou.Framework.VectorGraphics" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Framework.VectorGraphics" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Meziantou.Framework.VectorGraphics" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Meziantou.Framework.VectorGraphics --version 1.0.1
                    
#r "nuget: Meziantou.Framework.VectorGraphics, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Meziantou.Framework.VectorGraphics@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Meziantou.Framework.VectorGraphics&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Meziantou.Framework.VectorGraphics&version=1.0.1
                    
Install as a Cake Tool

Meziantou.Framework.VectorGraphics

Describes a drawing as a scene of shapes, paths, texts, images and groups, writes it as deterministic SVG, and measures, wraps and truncates texts with the metrics of Helvetica or any OpenType font. Meziantou.Framework.Charts and Meziantou.Framework.Diagrams lay themselves out into a scene; Meziantou.Framework.Imaging.VectorGraphics draws it as an image.

Usage

var scene = new Scene(width: 200, height: 80, fontFamily: AfmTextMeasurer.Default.FontFamily) { Title = "A box", Background = SceneColor.White };

// Shapes are filled and stroked; texts are positioned by their baseline
scene.Root.Add(new SceneRectangle(10, 10, 180, 60) { Fill = (SceneColor)"#e0f2fe", Stroke = (SceneColor)"#0369a1", StrokeWidth = 2, CornerRadius = 8 });
scene.Root.Add(new SceneText(100, 45, "Hello", new SceneFont(16, Weight: SceneFont.BoldWeight), (SceneColor)"#0c4a6e") { Anchor = SceneTextAnchor.Middle });

// Paths use the commands of SVG
var arrow = new PathBuilder().MoveTo(20, 60).LineTo(60, 60).LineTo(55, 55).MoveTo(60, 60).LineTo(55, 65).Build();
scene.Root.Add(new ScenePath(arrow) { Stroke = (SceneColor)"#0369a1" });

var svg = SvgSceneRenderer.Render(scene);

Wrap a text to fit a width:

var measurer = AfmTextMeasurer.Default;
var font = new SceneFont(12);

// At most 100 pixels per line, broken between words, and at the line feeds of the text
var lines = TextFitting.Wrap(measurer, "A label that is too long for its box\nSecond paragraph", font, maxWidth: 100);
Assert.Equal(["A label that is too", "long for its box", "Second paragraph"], lines);

// Or shortened with an ellipsis
Assert.Equal("A label that i…", TextFitting.Truncate(measurer, "A label that is too long", font, maxWidth: 80));
Product Compatible and additional computed target framework versions.
.NET 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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Meziantou.Framework.VectorGraphics:

Package Downloads
Meziantou.Framework.Avatar

Generate deterministic avatar images from names and bigrams, as SVG or as vector scenes to draw as PNG

Meziantou.Framework.Charts

Grammar-of-graphics chart library that renders deterministic SVG: bar, line, area, scatter, pie, radar, gauge, packed circles, treemap, sunburst, histogram, box plot, heatmap, waterfall, funnel, candlestick, choropleth maps and more, built from marks, scales, coordinates and transforms.

Meziantou.Framework.Diagrams

Diagrams written as deterministic SVG, inspired by Mermaid: 25 diagram types of Mermaid, from flowcharts, class, sequence, entity relationship, C4 and architecture diagrams to Gantt charts, mind maps, Venn diagrams and Wardley maps, laid out automatically, with the themes of Mermaid.

Meziantou.Framework.Imaging.VectorGraphics

Draws the scenes of Meziantou.Framework.VectorGraphics (charts, diagrams) with Meziantou.Framework.Imaging: images in any format (PNG, WebP, JPEG...), or vector drawing on a canvas, with embedded Liberation Sans fonts.

Meziantou.Framework.Pdf.VectorGraphics

Draws the scenes of Meziantou.Framework.VectorGraphics (charts, diagrams) as PDF with Meziantou.Framework.Pdf: vector shapes, gradients and text, with subsets of the fonts of the scene embedded.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 46 11/13/2026
1.0.0 89 11/10/2026