summaryrefslogtreecommitdiff
path: root/chickadee/graphics/font.scm
diff options
context:
space:
mode:
Diffstat (limited to 'chickadee/graphics/font.scm')
-rw-r--r--chickadee/graphics/font.scm25
1 files changed, 11 insertions, 14 deletions
diff --git a/chickadee/graphics/font.scm b/chickadee/graphics/font.scm
index c282c66..eb1de3f 100644
--- a/chickadee/graphics/font.scm
+++ b/chickadee/graphics/font.scm
@@ -42,6 +42,7 @@
#:use-module (chickadee graphics shader)
#:use-module (chickadee graphics sprite)
#:use-module (chickadee graphics texture)
+ #:use-module (chickadee utils)
#:use-module (rnrs bytevectors)
#:export (load-tile-font
load-bitmap-font
@@ -120,20 +121,16 @@ display it at POINT-SIZE. By default, the ASCII character is used."
(when (> (+ x width) texture-size)
(set! y next-y)
(set! x 0))
- (let y-loop ((row 0))
- (when (< row height)
- (let x-loop ((column 0))
- (when (< column width)
- (let ((gray (u8vector-ref glyph-pixels
- (+ (* row pitch) column)))
- (offset (+ (* (+ y row) texture-size 4)
- (* (+ x column) 4))))
- (u8vector-set! pixels offset 255)
- (u8vector-set! pixels (+ offset 1) 255)
- (u8vector-set! pixels (+ offset 2) 255)
- (u8vector-set! pixels (+ offset 3) gray))
- (x-loop (+ column 1))))
- (y-loop (+ row 1))))
+ (for-range ((column width)
+ (row height))
+ (let ((gray (u8vector-ref glyph-pixels
+ (+ (* row pitch) column)))
+ (offset (+ (* (+ y row) texture-size 4)
+ (* (+ x column) 4))))
+ (u8vector-set! pixels offset 255)
+ (u8vector-set! pixels (+ offset 1) 255)
+ (u8vector-set! pixels (+ offset 2) 255)
+ (u8vector-set! pixels (+ offset 3) gray)))
(let ((spec (list char x y width height left top advance)))
;; 1 pixel of padding to avoid artifacts when texture is
;; scaled up.