PeachDrawing.PDF

PdfRenderContext Class

The RenderContext a PdfCanvas draws with: the fonts (installed ones, plus every font added), images decoded for embedding, and the scale between layout units and PDF 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.

public class PdfRenderContext : PeachDrawing.Core.RenderContext

Inheritance System.Object → RenderContext → PdfRenderContext

Constructors  
PdfRenderContext() Init color resolve.
Properties  
LayoutUnitsPerPoint Fonts here are built at size / PixelsPerPoint points (see CreateFontInt), so PixelsPerPoint is part of a cached font’s identity.
PixelsPerPoint The scale between layout units and true PDF 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; 1.0 is the value of a context that has not been told, and must stay the “no scaling” case rather than repeat the unrelated 72 in “72 points per inch”, or every length that reads it silently scales by 72x.
Methods  
AddFont(Stream, string) Adds a font to the context so pages can draw with it. TrueType, OpenType, WOFF and WOFF2 are recognized by their content.
AddFont(Stream, string, FontFaceDescriptors, IReadOnlyList<RuneInterval>) Adds a font to the context 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.