diff options
author | David Thompson <dthompson2@worcester.edu> | 2022-12-27 15:53:46 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2022-12-27 15:53:46 -0500 |
commit | 9a2690d9dfe91604f67f2de09d4f3b316f7db6f4 (patch) | |
tree | 8d8d6fe6844ebcb7cd4bfac239b67bf453cec77b | |
parent | 239d333807f82748aa74665035adf455cffb5e6c (diff) |
graphics: text: Add #:smooth? keyword argument to make-texture.
-rw-r--r-- | chickadee/graphics/text.scm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/chickadee/graphics/text.scm b/chickadee/graphics/text.scm index 8235242..ca33cb7 100644 --- a/chickadee/graphics/text.scm +++ b/chickadee/graphics/text.scm @@ -136,9 +136,12 @@ (define freetype-handle (delay (init-freetype))) -(define* (load-font file-name point-size #:key (char-set char-set:ascii)) +(define* (load-font file-name point-size #:key (char-set char-set:ascii) (smooth? #t)) "Load all the glyphs in CHAR-SET from the font in FILE-NAME and -display it at POINT-SIZE. By default, the ASCII character is used." +display it at POINT-SIZE. By default, the ASCII character is used. +If SMOOTH? is #t (the default), text rendered with this font will have +a smoother appearance when text is rotated or scaled, otherwise +non-smooth scaling will be used." (unless (file-exists? file-name) (error "no such file" file-name)) (let ((face (load-face (force freetype-handle) file-name)) @@ -193,8 +196,11 @@ display it at POINT-SIZE. By default, the ASCII character is used." prev))))))) '() char-set)) + (texture-filter (if smooth? 'linear 'nearest)) ;; TODO: Use multiple textures if needed. - (texture (make-texture pixels texture-size texture-size))) + (texture (make-texture pixels texture-size texture-size + #:min-filter texture-filter + #:mag-filter texture-filter))) ;; Process kernings. (char-set-for-each (lambda (left) |