summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/freetype.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/chickadee/freetype.scm b/chickadee/freetype.scm
index 73c0791..de93d00 100644
--- a/chickadee/freetype.scm
+++ b/chickadee/freetype.scm
@@ -83,8 +83,14 @@
(define FT_LOAD_COMPUTE_METRICS 32768)
(define FT_LOAD_BITMAP_METRICS_ONLY 65536)
-(define-foreign ft-error-string
- '* "FT_Error_String" (list int))
+;; FT_Error_String only exists in libfreetype 2.10.0+, and we wish to
+;; support older versions so we stub out the function when it doesn't
+;; exist.
+(define ft-error-string
+ (or (false-if-exception (freetype-func '* "FT_Error_String" (list int)))
+ (lambda (error-code)
+ (string->pointer
+ (string-append "error code " (number->string error-code))))))
(define-foreign ft-init-freetype
int "FT_Init_FreeType" '(*))