Table of Contents

Class GlyphCache

Namespace
Egami.Drawing
Assembly
Egami.Drawing.dll

The process-wide cache of glyph coverage masks the raster canvas draws small text from: one mask per typeface (each variation position its own), glyph, device em size, axis scales, subpixel phase, edging, hinting and synthesis, for glyphs up to 256 device pixels per em under a scale-and-translate transform. Masks hold one byte per pixel, or three for LCD edging. Bigger, rotated or skewed glyphs fill as paths and are not cached. Masks are rendered by the same rasterizer as paths and drawn at the same rounded positions either way, so the cache changes speed, never pixels. Shared by every canvas on every thread; least recently used masks go first when the budget is spent.

public static class GlyphCache
Inheritance
GlyphCache
Inherited Members

Examples

// Small text draws from a process-wide cache of glyph masks; give it more room for many fonts and sizes.
GlyphCache.ByteLimit = 16 * 1024 * 1024;
GlyphCache.Clear();

Properties

ByteLimit

Gets or sets the most bytes the masks may hold, 4 MiB by default; 0 turns caching off. Lowering it evicts at once. The cache is one for the whole process, shared by every canvas and context, as Skia's font cache is; setting the limit is safe from any thread.

public static long ByteLimit { get; set; }

Property Value

long

Exceptions

ArgumentOutOfRangeException

The value is negative.

Methods

Clear()

Drops every cached mask.

public static void Clear()