PeachDrawing.Text

PeachDrawing.Text.Compression

BrotliDecompression Class

A pluggable decoder for the Brotli-compressed data PeachDrawing.Text reads: the Unicode, hyphenation and dictionary data of its PeachDrawing.Text.Data dependency, and WOFF2 font data (Brotli-compressed by the WOFF2 specification itself). By default, PeachDrawing.Text decompresses with .NET’s own System.IO.Compression.BrotliStream. On a host where that throws System.PlatformNotSupportedException - WebAssembly in a browser, at the time of writing - the affected feature quietly degrades instead of the render failing: a Unicode table comes back empty, text lays out unhyphenated, and a WOFF2 font is skipped as if it could not be read. Call SetDecompressor(Func<Stream,Stream>) once, before using PeachDrawing.Text, to supply a managed Brotli implementation instead and recover that data on such a host.

public static class BrotliDecompression

Inheritance System.Object → BrotliDecompression

Methods  
SetDecompressor(Func<Stream,Stream>) Registers decompressor as the decoder PeachDrawing.Text falls back to when the .NET runtime’s own Brotli support is unavailable. It receives the compressed data as a System.IO.Stream and must return a System.IO.Stream - most simply a System.IO.MemoryStream already holding the whole decompressed result - that yields the decompressed bytes when read; PeachDrawing.Text disposes both the stream it passed in and the one returned. Pass null to go back to the default (BCL-only) behavior, which is also what happens if this is never called: every default’s behavior is unchanged from before this seam existed.