Dashboard/Quik/Media/QFont.cs

33 lines
985 B
C#

using System;
namespace Quik.Media
{
/// <summary>
/// Abstract class that represents a font.
/// </summary>
public abstract class QFont : IDisposable
{
public abstract FontInfo Info { get; }
public string Family => Info.Family;
public FontStyle Style => Info.Style;
public float Size => Info.Size;
public abstract bool HasRune(int rune);
public abstract QImage RenderPage(int codepage, float resolution, bool sdf);
public abstract QGlyphMetrics GetMetricsForRune(int rune);
public abstract QGlyphMetrics[] GetMetricsForPage(int codepage);
// IDisposable
private bool isDisposed = false;
private void DisposePrivate(bool disposing)
{
if (isDisposed) return;
Dispose(disposing);
isDisposed = true;
}
protected virtual void Dispose(bool disposing) { }
public void Dispose() => DisposePrivate(true);
}
}