summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/graphics/text.scm12
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)