     }
   }
 
-}
+  public func withStyle<Result>(style: Int32,
+      @noescape fn: () -> Result) -> Result {
+    if style == self.style {
+      return fn()
+    } else {
+      styleStack.append(self.style)
+      defer {
+        self.style = styleStack.removeLast()
+      }
+      self.style = style
+      return fn()
+    }
+  }
+}

  public let KEY_UP: UInt16   = 769

  public let RENDERER_ACCELERATED: UInt32 = 2

  public var _textGrid: TextGrid?


  public var descent: Int32 = 0
  public var colorStack = [SDL_Color?]()
  public var styleStack = [Int32]()
  public var style: Int32 = 0

  public init(renderer: COpaquePointer, font: COpaquePointer) {
    self.renderer = renderer
