FontSettings.SaveSearchCache
FontSettings SaveSearchCache method. Saves the font search cache to the stream.
FontSettings.SaveSearchCache method
Saves the font search cache to the stream.
public void SaveSearchCache(Stream outputStream)
Parameter | Type | Description |
---|---|---|
outputStream | Stream | Output stream. |
Remarks
See SetFontsSources
method description for more info.
Examples
Shows how to speed up the font cache initialization process.
const string cacheKey1 = "NoticiaText-Regular";
const string cacheKey2 = "NoticiaText-Bold";
FontSettings parsedFonts = new FontSettings();
FontSettings loadedCache = new FontSettings();
// Set font sources.
parsedFonts.SetFontsSources(new FontSourceBase[]
{
new FileFontSource(FontsDir + "NoticiaText-Regular.ttf", 0, cacheKey1),
new FileFontSource(FontsDir + "NoticiaText-Bold", 0, cacheKey2)
});
using (MemoryStream cacheStream = new MemoryStream())
{
parsedFonts.SaveSearchCache(cacheStream);
Console.WriteLine(cacheStream.Position);
// Load the font into another font setting instance using cached information.
loadedCache.SetFontsSources(new FontSourceBase[]
{
new FileFontSource(FontsDir + "NoticiaText-Regular.ttf", 0, cacheKey1),
new FileFontSource(FontsDir + "NoticiaText-Bold", 0, cacheKey2)
}, cacheStream);
}
See Also
- class FontSettings
- namespace Wordize.Fonts
- assembly Wordize