Class FontCache
- Namespace
- KernSmith
- Assembly
- KernSmith.dll
Thread-safe cache for font data bytes, supporting file paths, system fonts, and raw data.
public sealed class FontCache
- Inheritance
-
FontCache
- Inherited Members
Properties
Count
Number of fonts currently in the cache.
public int Count { get; }
Property Value
Methods
Add(string, byte[])
Adds raw font data bytes to the cache under the specified key.
public void Add(string key, byte[] fontData)
Parameters
Clear()
Removes all entries from the cache.
public void Clear()
Contains(string)
Returns true if the specified key exists in the cache.
public bool Contains(string key)
Parameters
keystring
Returns
Get(string)
Retrieves cached font data by key. Throws if the key is not cached.
public byte[] Get(string key)
Parameters
keystring
Returns
- byte[]
LoadFile(string)
Loads a font file from disk and caches it by its full file path.
public void LoadFile(string path)
Parameters
pathstring
LoadSystemFont(string)
Resolves a system font by family name and caches the font data.
public void LoadSystemFont(string fontFamily)
Parameters
fontFamilystring
TryGet(string, out byte[])
Attempts to retrieve cached font data. Returns true if found.
public bool TryGet(string key, out byte[] fontData)