GlyphScratch Class

The working storage of the decoding of a glyph, charged to an allocator. It grows to the largest glyph and is kept by its owner, so that decoding the same glyphs again allocates nothing.

public sealed class GlyphScratch : IDisposable

Remarks

A font has no cache and no state of its own: several threads can decode its glyphs, each with its own scratch.

Implements

Constructors

NameDescription
GlyphScratch(FontAllocator)Initializes a new instance of the GlyphScratch class.

GlyphScratch(FontAllocator)

GlyphScratch.cs

Initializes a new instance of the GlyphScratch class.

public GlyphScratch(FontAllocator scope)

Parameters

scope FontAllocator
The allocator the storage is rented from.

Properties

NameDescription
CountGets the number of points.
WorkGets the working numbers that are rented.

Gets the number of points.

public int Count { get; }

Property value

int

Gets the working numbers that are rented.

public Span<double> Work { get; }

Property value

Span<double>

Methods

NameDescription
Add(int)Adds points, whose content is unspecified, and returns the index of the first one.
Dispose()Returns the storage to the allocator.
RentWork(long)Rents working numbers, set to zero, after the ones already rented. The storage can move: a span of GlyphScratch.Work must not be kept across another rental.
Reset()Removes every point and keeps the storage.
ReturnWork(int)Returns the working numbers rented last.

Adds points, whose content is unspecified, and returns the index of the first one.

public int Add(int count)

Parameters

count int

Returns

int

Exceptions

FontResourceLimitException
The points exceed the allocation limit.

Returns the storage to the allocator.

public void Dispose()

RentWork(long)

GlyphScratch.cs

Rents working numbers, set to zero, after the ones already rented. The storage can move: a span of GlyphScratch.Work must not be kept across another rental.

public int RentWork(long count)

Parameters

count long

Returns

int The index of the first number in GlyphScratch.Work.

Removes every point and keeps the storage.

public void Reset()

ReturnWork(int)

GlyphScratch.cs

Returns the working numbers rented last.

public void ReturnWork(int start)

Parameters

start int