summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2013-10-11 21:30:27 -0400
committerDavid Thompson <dthompson2@worcester.edu>2013-10-11 21:30:27 -0400
commit3307f1b381eb12999d39984486146ed504dbb6c2 (patch)
tree49cc1b02fc6cf24ed2797aa80dc77ec7ad9f45a3 /2d
parent36d05b308d710f58b60f695799605648bac5d3a3 (diff)
Add error handling to ftgl-create-texture-font.
Diffstat (limited to '2d')
-rw-r--r--2d/wrappers/ftgl.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/2d/wrappers/ftgl.scm b/2d/wrappers/ftgl.scm
index 537655c..1ff42d7 100644
--- a/2d/wrappers/ftgl.scm
+++ b/2d/wrappers/ftgl.scm
@@ -80,8 +80,12 @@
float "ftglGetFontAscender" '(*))
(define (ftgl-create-texture-font filename)
- (wrap-ftgl-font
- (%ftgl-create-texture-font (string->pointer filename))))
+ (unless (file-exists? filename)
+ (throw 'font-not-found filename))
+ (let ((font (%ftgl-create-texture-font (string->pointer filename))))
+ (when (null-pointer? font)
+ (throw 'font-load-failure filename))
+ (wrap-ftgl-font font)))
(define (ftgl-set-font-face-size font size res)
(%ftgl-set-font-face-size (unwrap-ftgl-font font) size res))