public DWriteFontCollectionLoader() { using (var fac = DWriteFunctions.DWriteCreateFactory()) { fac.Object.RegisterFontCollectionLoader(this).ThrowOnError(); fac.Object.RegisterFontFileLoader(_loader).ThrowOnError(); } }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { // dispose managed state (managed objects). } // free unmanaged resources (unmanaged objects) and override a finalizer below. // set large fields to null. using (var fac = DWriteFunctions.DWriteCreateFactory()) { fac.Object.UnregisterFontFileLoader(_loader).ThrowOnError(); fac.Object.UnregisterFontCollectionLoader(this).ThrowOnError(); } _loader.Dispose(); _disposedValue = true; } }