summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2020-12-16 20:17:16 -0500
committerDavid Thompson <dthompson2@worcester.edu>2020-12-16 20:17:16 -0500
commitd247b5fa5f7918665890952918c857fe20333b1c (patch)
treee0ac1e4981f74ad8f14572e4b88d6ef58b13c110
parent4e5b59b1e672667b7aa8793469ba2f937a9be198 (diff)
graphics: font: Fix artifacts when scaling fonts.
-rw-r--r--chickadee/graphics/font.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/chickadee/graphics/font.scm b/chickadee/graphics/font.scm
index f41b89a..d022e86 100644
--- a/chickadee/graphics/font.scm
+++ b/chickadee/graphics/font.scm
@@ -136,8 +136,10 @@ display it at POINT-SIZE. By default, the ASCII character is used."
(x-loop (+ column 1))))
(y-loop (+ row 1))))
(let ((spec (list char x y width height left top advance)))
- (set! x (+ x width))
- (set! next-y (max next-y (+ y height)))
+ ;; 1 pixel of padding to avoid artifacts when texture is
+ ;; scaled up.
+ (set! x (+ x width 1))
+ (set! next-y (max next-y (+ y height 1)))
spec))
;; Render individual glyph bitmaps and compose them into larger
;; images to be used as textures.