PeachDrawing.Svg

SvgRenderContext Class

The RenderContext an SvgCanvas draws with: the fonts (installed ones, plus every font added), images decoded for embedding, and the scale between layout units and points. A host adds what is specific to it - HTML and CSS font-family aliases, font-variation-settings parsing, resource loading - by deriving from it, exactly as for the PDF render context.

public class SvgRenderContext : PeachDrawing.Core.RenderContext

Inheritance System.Object → RenderContext → SvgRenderContext

Constructors  
SvgRenderContext() Creates a render context with every font installed on the machine already registered by name.
Properties  
LayoutUnitsPerPoint Fonts are built at size / PixelsPerPoint points, so PixelsPerPoint is part of a cached font’s identity.
PixelsPerPoint The scale between layout units and points: 1.0 (no scaling) draws one layout unit as one point. A host that lays out in another unit (PixelsPerInch / 72 layout units per point) sets it before drawing anything.
Methods  
AddFont(Stream, string) Adds a font to the context so canvases can draw with it. TrueType, OpenType, WOFF and WOFF2 are recognised by their content.
AddFont(Stream, string, FontFaceDescriptors, IReadOnlyList<RuneInterval>) Adds a font like AddFont(Stream, string), restricting which weights, widths and styles it is matched for and which characters it supplies.
GetCssMediaType(IEnumerable<string>) The CSS media type (e.g. "print", "screen") this render context evaluates media queries against, chosen from mediaTypesAvailable.