using System; using System.Collections.Generic; using System.IO; using Quik.Media.Font; namespace Quik.PAL { /// /// Flags that effect font search criterea. /// [Flags] public enum FontMatchCriteria { None = 0, Family = 1 << 0, Slant = 1 << 1, Weight = 1 << 2, Stretch = 1 << 3, All = Family | Slant | Weight | Stretch, } /// /// An abstraction over the system font database. /// public interface IFontDataBase { /// /// All the fonts installed in the system. /// IEnumerable All { get; } public FontFace Serif => GetSystemFontFace(SystemFontFamily.Serif); public FontFace Sans => GetSystemFontFace(SystemFontFamily.Sans); public FontFace Monospace => GetSystemFontFace(SystemFontFamily.Monospace); public FontFace Cursive => GetSystemFontFace(SystemFontFamily.Cursive); public FontFace Fantasy => GetSystemFontFace(SystemFontFamily.Fantasy); /// /// Search for the given font face. /// /// The font face prototype. /// The match criteria /// A list of fonts sorted by the closest match first. IEnumerable Search(FontFace prototype, FontMatchCriteria criteria = FontMatchCriteria.All); /// /// Get the font face file info if it exists. /// /// The face to look for. /// The file info if it exists. FileInfo FontFileInfo(FontFace face); /// /// Open a font face. /// /// The font face to open. /// The stream to the font face. Stream Open(FontFace face); /// /// Get a system font family. /// /// The family type to look up. /// The name of a font in this family. FontFace GetSystemFontFace(SystemFontFamily family); } }