public FontSystem(FontSystemSettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } _settings = settings.Clone(); if (_settings.FontLoader == null) { var loaderSettings = new StbTrueTypeSharpSettings { KernelWidth = _settings.KernelWidth, KernelHeight = _settings.KernelHeight }; _fontLoader = new StbTrueTypeSharpLoader(loaderSettings); } else { _fontLoader = _settings.FontLoader; } }
public StbTrueTypeSharpSource(byte[] data, StbTrueTypeSharpSettings settings) { if (data == null) { throw new ArgumentNullException(nameof(data)); } _font = CreateFont(data, 0); if (_font == null) { throw new Exception("stbtt_InitFont failed"); } _settings = settings; int ascent, descent, lineGap; stbtt_GetFontVMetrics(_font, &ascent, &descent, &lineGap); _ascent = ascent; _descent = descent; _lineHeight = ascent - descent + lineGap; }
public StbTrueTypeSharpLoader(StbTrueTypeSharpSettings settings) { _settings = settings; }