diff options
author | David Thompson <dthompson2@worcester.edu> | 2020-12-05 13:05:33 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2020-12-05 13:05:33 -0500 |
commit | f4df3a7ac08bb6c50956bf27534d4f51423ec863 (patch) | |
tree | 10842f0239775a233a8a8f3035cbb0063c4ee20d | |
parent | 04f8a22e3f1570dc3ccf75449ee31bd43bfa8353 (diff) |
ttf: Return multiple values instead of a list in font-size.
-rw-r--r-- | doc/api.texi | 5 | ||||
-rw-r--r-- | sdl2/ttf.scm | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/doc/api.texi b/doc/api.texi index 2ce58b9..7b19651 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -1559,9 +1559,8 @@ Return the recommended pixel height of a line of text using @end deffn @deffn {Procedure} font-size-text font text -Return a 2-element list containing the resulting surface size of the -string @var{text} using @var{font} in the following format: -@code{(width height)}. +Return 2 values for the resulting surface size of the string +@var{text} using @var{font}. @end deffn @deffn {Procedure} font-glyph-index font char diff --git a/sdl2/ttf.scm b/sdl2/ttf.scm index f3161b2..b1345d6 100644 --- a/sdl2/ttf.scm +++ b/sdl2/ttf.scm @@ -94,14 +94,14 @@ size is POINT-SIZE." (ffi:ttf-font-line-skip (unwrap-font font))) (define (font-size font text) - "Return a 2-element list containing the resulting surface size of -the string TEXT using FONT in the following format: (width height)." + "Return 2 values for the resulting surface size of the string TEXT +using FONT." (let ((bv (make-s32vector 2))) (if (zero? (ffi:ttf-size-utf8 (unwrap-font font) (string->pointer text) (bytevector->pointer bv) (bytevector->pointer bv 4))) - (s32vector->list bv) + (values (s32vector-ref bv 0) (s32vector-ref bv 1)) (sdl-error "size-utf8" "failed to get size utf8")))) (define (font-glyph-index font char) |