From 3307f1b381eb12999d39984486146ed504dbb6c2 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 11 Oct 2013 21:30:27 -0400 Subject: Add error handling to ftgl-create-texture-font. --- 2d/wrappers/ftgl.scm | 8 ++++++-- 1 file 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)) -- cgit v1.2.3