     
     internal var glyphDescriptors = [GlyphDescriptor]()
     
-    private (set) var textureData = [UInt8]()
+    private var _textureData = [UInt8]()
+    
+    private (set) var texture: Texture! = nil
     
     private var MBE_GENERATE_DEBUG_ATLAS_IMAGE = true
 
     /// Create a signed-distance field based font atlas with the specified dimensions.
     /// The supplied font will be resized to fit all available glyphs in the texture.
-    private init (font: String, pointSize: Float, textureSize: Int = MBEFontAtlasSize) {
+    private init (context: Context, font: String, pointSize: Float, textureSize: Int = MBEFontAtlasSize) {
         parentFont = CTFontCreateWithName(font, CGFloat(pointSize), nil)
         _fontPointSize = Int(ceilf(Float(pointSize)))
         _textureSize = textureSize
         spread = estimatedLineWidthForFont(parentFont) * 0.5
         createTextureData()
+        createTexture(context)
     }
 /*
     - (instancetype)initWithCoder:(NSCoder *)aDecoder

        let spread = estimatedLineWidthForFont(parentFont) * 0.5
        
        // Quantize the downsampled distance field into an 8-bit grayscale array suitable for use as a texture
        textureData = createQuantizedDistanceField(
            distanceField: scaledField,
            width: _textureSize,
            height: _textureSize,

let MBETextureWidthKey = "textureWidth"
let MBEGlyphDescriptorsKey = "glyphDescriptors"

class FontAtlas {

    private (set) var parentFont: CTFont
    
