GlyphCache Class
Keeps what drawing a glyph computes from one draw call to the next, up to a number of bytes: the coverage of a glyph at a position in a pixel, and the display list of a glyph a font draws with its own colors.
public sealed class GlyphCacheRemarks
A cache is given to DrawingCanvas.FillGlyphs by GlyphRunOptions.Cache. A glyph is found again for the same font object (a Font and the fonts Font.WithVariations makes are different fonts), glyph, size, transformation of the canvas, position in its pixel (a quarter of a pixel along the line, a whole pixel across it), antialiasing and synthetic bold. The pixels are the same with or without a cache: only the time and the allocations of a draw call change.
When an entry does not fit, the entries used least recently are removed. The bytes of an entry are an estimate of what it holds. A cache is thread-safe; it holds the fonts of its entries until they are removed.
Constructors
| Name | Description |
|---|---|
| GlyphCache(long) | Initializes a new instance of the GlyphCache class. |
GlyphCache(long)
GlyphCache.csInitializes a new instance of the GlyphCache class.
public GlyphCache(long maxBytes)Parameters
maxByteslong- The most bytes the entries may hold.
Exceptions
ArgumentOutOfRangeExceptionmaxBytesis negative.
Properties
| Name | Description |
|---|---|
| Bytes | Gets the bytes the entries hold. |
| Count | Gets the number of entries. |
| MaxBytes | Gets the most bytes the entries may hold. |
Bytes
GlyphCache.csCount
GlyphCache.csMaxBytes
GlyphCache.csMethods
| Name | Description |
|---|---|
| Clear() | Removes every entry. |
Clear()
GlyphCache.csRemoves every entry.
public void Clear()