                     (key.shape as? ShiftShape)?.withLock = (self.shiftState == .Locked)
                 }
             }
+        }
+    }
+    
+    func setKeyCapForKey(lowercase: Bool, characterLowercase: Bool, model: Key, view: KeyboardKey) {
+        if model.type == .Character {
+            view.text = model.keyCapForCase(!characterLowercase)
+        }
+        else {
+            view.text = model.keyCapForCase(!lowercase)
         }
     }
     

                        break
                    }
                    
                    if key.hasOutput {
                        keyView.addTarget(self, action: "keyPressedHelper:", forControlEvents: .TouchUpInside)
                    }
                    
                    if key.isCharacter {
                        if UIDevice.currentDevice().userInterfaceIdiom != UIUserInterfaceIdiom.Pad {
                            keyView.addTarget(self, action: Selector("showPopup:"), forControlEvents: .TouchDown | .TouchDragInside | .TouchDragEnter)
                            keyView.addTarget(keyView, action: Selector("hidePopup"), forControlEvents: .TouchDragExit)
                            keyView.addTarget(self, action: Selector("hidePopupDelay:"), forControlEvents: .TouchUpInside | .TouchUpOutside | .TouchDragOutside)
                        }
                    }
                    
                    if key.type != Key.KeyType.Shift {

            let characterUppercase = (NSUserDefaults.standardUserDefaults().boolForKey(kSmallLowercase) ? !lowercase : true)
            
            for (model, key) in self.layout!.modelToView {
                self.setKeyCapForKey(lowercase, characterLowercase: !characterUppercase, model: model, view: key)
                
                if model.type == Key.KeyType.Shift {
                    switch self.shiftState {
