         set {
             guard let font = HPDF_GetFont(_documentHandle, newValue.name, encoding.name) else {
                 
-                switch _document?._error {
-                case .some(PDFError.invalidFontName):
+                switch _document._error {
+                case PDFError.invalidFontName:
                     preconditionFailure("Font \(newValue) must be loaded in the document using " +
                         "loadTrueTypeFont(from:embeddingGlyphData:) or " +
                         "loadTrueTypeFontFromCollection(from:index:embeddingGlyphData:) methods.")
-                case .some(let error):
-                    preconditionFailure(error.description)
                 default:
-                    return
+                    preconditionFailure(_document._error.description)
                 }
             }
             

#endif
import Foundation

public final class DrawingContext {
    
    private weak var _document: PDFDocument?
    private var __page: HPDF_Page
    private var _documentHandle: HPDF_Doc
    private var _isInvalidated = false

        
        _document = page.document
        
        _documentHandle = _document._documentHandle
    }
    
    internal func _cleanup() {
