Table of Contents

Class SvgProcessor

Namespace
EncDotNet.S100.Portrayals
Assembly
EncDotNet.S100.Portrayals.dll

Processes S-100 SVG symbols by resolving CSS class-based styling to inline attributes, removing layout/metadata elements, and stripping processing instructions that reference external CSS stylesheets.

public static class SvgProcessor
Inheritance
SvgProcessor
Inherited Members

Remarks

S-100 Part 9 defines SVG symbols using CSS classes that reference colour tokens from the active colour palette. This processor converts those classes to inline attributes so the SVG can be rendered without external CSS resources.

CSS class conventions:

  • fTOKEN — fill colour (e.g. fCHBLK → fill:#000000)
  • sTOKEN — stroke colour (e.g. sOUTLW → stroke:#464646)
  • f0 — fill:none
  • sl — round line caps and joins
  • layout — layout-only elements (not rendered)

Methods

Process(string, ColorPalette?, double?)

Processes an S-100 SVG symbol by:

  1. Removing <?xml-stylesheet?> processing instructions
  2. Removing layout elements (symbolBox, svgBox, pivotPoint)
  3. Resolving CSS class names to inline style attributes using the given palette
  4. Optionally scaling stroke-width values by a given factor
  5. Removing metadata, title, and desc elements
public static string Process(string svgContent, ColorPalette? palette, double? strokeWidthScale = null)

Parameters

svgContent string

The raw SVG content string.

palette ColorPalette

The colour palette to resolve tokens against. When null, tokens are resolved to black as a fallback.

strokeWidthScale double?

Optional multiplier applied to all stroke-width attribute values. Pass null to leave stroke widths in their original mm units. For example, pass 3.78 to convert mm to pixels at 96 DPI.

Returns

string

The processed SVG content string with inline styles and no external dependencies.