summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-09-25 13:20:20 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-09-25 13:20:54 -0400
commitd43fbadd2eebf8ad7886dd22c8ee94d3d1613c08 (patch)
tree97da6142308dec90a044ccf4507679f84bd4f537
parent2501d7135d324a50a42ae94f829937329ff5435c (diff)
freetype: Support old versions that do not have FT_Error_String.
-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" '(*))