summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2018-04-21 20:06:10 -0400
committerDavid Thompson <dthompson2@worcester.edu>2018-04-21 20:06:10 -0400
commitacab405e3c67e508aba618b68a3cf59d7a5d367f (patch)
tree248b47e6225cdddd5b2aad3238db6244faeb8a73
parent257104e6359ce08f366b645f67b5285749623ad0 (diff)
render: font: Print "?" instead of crashing when character is missing.
* chickadee/render/font.scm (draw-text*): Default to "?" character when the desired character isn't present in the font.
-rw-r--r--chickadee/render/font.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/chickadee/render/font.scm b/chickadee/render/font.scm
index caa43ca..1a01ad4 100644
--- a/chickadee/render/font.scm
+++ b/chickadee/render/font.scm
@@ -302,7 +302,8 @@ extension must be either .xml or .fnt."
(lambda* (font text matrix #:key (blend-mode 'alpha))
;; TODO: Respect kerning.
(define (render-char c)
- (let* ((char (font-ref font c))
+ ;; TODO: What if "?" isn't in the font?
+ (let* ((char (or (font-ref font c) (font-ref font #\?)))
(texture (font-char-texture-region char))
(dimensions (font-char-dimensions char))
(offset (font-char-offset char)))