using FastReport.Fonts; using System; using System.Drawing; public class TTFState : IDisposable { private bool disposedValue; public TTFState(Font source_font) { string fast_font = source_font.FontFamily.Name + (source_font.Bold ? "-B" : string.Empty) + (source_font.Italic ? "-I" : string.Empty); FastFontName = fast_font; SourceFont = source_font; Value = FastReport.Fonts.FontStreamPool.GetTTF(fast_font, source_font); } public TrueTypeFont Value { get; } public string FastFontName { get; } public Font SourceFont { get; } protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { FastReport.Fonts.FontStreamPool.ReleaseFontStream(Value); } // TODO: set large fields to null disposedValue = true; } } // // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources // ~TTFState() // { // // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method // Dispose(disposing: false); // } public void Dispose() { // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method Dispose(disposing: true); GC.SuppressFinalize(this); } }