   (clear-display-buffer controller)
   (let [welcome (str "Welcome to " (version/title))
         version (str "version " (version/tag))
-        graphics (create-graphics controller)]
+        graphics (create-graphics controller)
+        context (.getFontRenderContext graphics)]
     (.setFont graphics (get-display-font :roboto-medium Font/PLAIN 42))
     (.setPaint graphics (java.awt.Color/WHITE))
-    (let [metrics (.getFontMetrics graphics)
-          x (int (- (/ Wayang/DISPLAY_WIDTH 2) (/ (.stringWidth metrics welcome) 2)))]
+    (let [x (int (- (/ Wayang/DISPLAY_WIDTH 2) (/ (string-width welcome (.getFont graphics) context) 2)))]
       (.drawString graphics welcome x 80))
     (.setFont graphics (get-display-font :condensed-light Font/ITALIC 20))
     (.setPaint graphics (java.awt.Color/BLUE))
-    (let [metrics (.getFontMetrics graphics)
-          x (int (- (/ Wayang/DISPLAY_WIDTH 2) (/ (.stringWidth metrics version) 2)))]
+    (let [x (int (- (/ Wayang/DISPLAY_WIDTH 2) (/ (string-width version (.getFont graphics) context) 2)))]
       (.drawString graphics version x 110))
     (let [afterglow-logo (javax.imageio.ImageIO/read
                           (.getResourceAsStream Effect "/public/img/Afterglow-logo-padded-left.png"))

(defn calculate-text-width
  "Figure out how many pixels wide some text will be in a given font."
  [graphics font text]
  (let [metrics (.getFontMetrics graphics font)]
    (.stringWidth metrics text)))

(defn draw-bottom-button-label
  "Draw a label for a button below the graphical display."
  [controller index text color]
  (let [graphics (create-graphics controller)
        font (get-display-font :roboto-medium Font/BOLD 14)
        metrics (.getFontMetrics graphics font)
        label (fit-string text metrics (- button-cell-width button-cell-margin))
        width (.stringWidth metrics label)]
    (set-graphics-color graphics color)
    (.setFont graphics font)
    (.drawString graphics label (int (math/round (- (* (+ index 0.5) button-cell-width) (/ width 2))))

  parameters."
  [show port-in port-out device refresh-interval display-name]
  {:pre [(some? show)]}
  (load-fonts)
  (let [modes (atom #{})
        controller
        (with-meta
