From 94cf078315a46df2b460e53bd0dfc681ae9cf2ab Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 14 Dec 2018 17:26:45 -0800 Subject: [PATCH] fontland updates --- quad/quad/position.rkt | 6 +++--- quad/quad/test-glyph-layout.rkt | 8 ++------ quad/quad/typewriter-test.rkt | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/quad/quad/position.rkt b/quad/quad/position.rkt index 8e569853..b1ba5d9d 100644 --- a/quad/quad/position.rkt +++ b/quad/quad/position.rkt @@ -23,7 +23,7 @@ (define (get-font p) (define fonts (make-hash)) - (hash-ref! fonts p (λ () (openSync p)))) + (hash-ref! fonts p (λ () (open-font p)))) (define ascender-cache (make-hash)) (define/contract (ascender q) @@ -31,7 +31,7 @@ (define p (hash-ref (attrs q) 'font "Courier")) (unless p (error 'ascender-no-font-key)) - (hash-ref! ascender-cache p (λ () (ascent (get-font p))))) + (hash-ref! ascender-cache p (λ () (font-ascent (get-font p))))) (define units-cache (make-hash)) (define/contract (units-per-em q) @@ -39,7 +39,7 @@ (define p (hash-ref (attrs q) 'font "Courier")) (unless p (error 'units-per-em-no-font-key)) - (hash-ref! units-cache p (λ () (unitsPerEm (get-font p))))) + (hash-ref! units-cache p (λ () (font-units-per-em (get-font p))))) (define (fontsize q) ;; this needs to not default to 0 diff --git a/quad/quad/test-glyph-layout.rkt b/quad/quad/test-glyph-layout.rkt index 2ff72cad..6d8b1ad8 100644 --- a/quad/quad/test-glyph-layout.rkt +++ b/quad/quad/test-glyph-layout.rkt @@ -1,12 +1,8 @@ #lang br (require fontland/font) -(define f (openSync "fira.ttf")) +(define f (open-font "fira.ttf")) (define gr (time (layout f "fifl"))) -(get-field glyphs gr) - -(get-field positions gr) - -(send gr advanceWidth) \ No newline at end of file +gr \ No newline at end of file diff --git a/quad/quad/typewriter-test.rkt b/quad/quad/typewriter-test.rkt index e9d46b79..9682bbea 100644 --- a/quad/quad/typewriter-test.rkt +++ b/quad/quad/typewriter-test.rkt @@ -1,3 +1,3 @@ -#lang quad/typewriter 25 +#lang quad/typewriter 40 ◊quad[#:fontsize "11"]{Get Ready ◊quad[#:link "http://beautifulracket.com"]{An expression that} is not a value can ◊quad[#:fontsize "22"]{always} ◊quad[#:fontsize "7"]{be partitioned} into two parts: a redex, which is the part that changed in a single-step simplification (highlighted), and the continuation, which is the evaluation context surrounding an expression. In (- 4 (+ 1 1)), the redex is (+ 1 1), and the continuation is (- 4 []), where [] takes the place of the redex. That is, the continuation says how to "continue" after the redex is reduced to a value. ◊quad[#:link "http://beautifulracket.com"]{An expression that} is not a value can ◊quad[#:fontsize "22"]{always} ◊quad[#:fontsize "7"]{be partitioned} into two parts: a redex, which is the part that changed in a single-step simplification (highlighted), and the continuation, which is the evaluation context surrounding an expression. In (- 4 (+ 1 1)), the redex is (+ 1 1), and the continuation is (- 4 []), where [] takes the place of the redex. That is, the continuation says how to "continue" after the redex is reduced to a value. ◊quad[#:link "http://beautifulracket.com"]{An expression that} is not a value can ◊quad[#:fontsize "22"]{always} ◊quad[#:fontsize "7"]{be partitioned} into two parts: a redex, which is the part that changed in a single-step simplification (highlighted), and the continuation, which is the evaluation context surrounding an expression. In (- 4 (+ 1 1)), the redex is (+ 1 1), and the continuation is (- 4 []), where [] takes the place of the redex. That is, the continuation says how to "continue" after the redex is reduced to a value.}