From 68d23ebf02278f953cfb12b3731be844722bf72d Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 5 Dec 2018 16:48:53 -0800 Subject: [PATCH] +glyphrun --- fontland/fontland/glyphrun.rkt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fontland/fontland/glyphrun.rkt b/fontland/fontland/glyphrun.rkt index f4addd29..48b17870 100644 --- a/fontland/fontland/glyphrun.rkt +++ b/fontland/fontland/glyphrun.rkt @@ -16,6 +16,9 @@ https://github.com/mbutterick/fontkit/blob/master/src/layout/GlyphRun.js ; An array of GlyphPosition objects for each glyph in the run (struct glyphrun (glyphs positions) #:transparent) +(define (+glyphrun [glyphs null] [positions null]) + (glyphrun glyphs positions)) + (define (glyphrun-advance-width gr) (for/sum ([pos (in-list (glyphrun-positions gr))]) (glyph-position-x-advance pos))) @@ -32,6 +35,6 @@ https://github.com/mbutterick/fontkit/blob/master/src/layout/GlyphRun.js (module+ test (require rackunit) - (define gr (glyphrun null null)) + (define gr (+glyphrun)) (check-true (glyphrun? gr)) (check-equal? (append-glyphruns gr gr) gr))