diff --git a/fontland/fontland/font.rkt b/fontland/fontland/font.rkt index 30fd23c0..2355e112 100644 --- a/fontland/fontland/font.rkt +++ b/fontland/fontland/font.rkt @@ -233,14 +233,28 @@ https://github.com/mbutterick/fontkit/blob/master/src/TTFFont.js CFFGlyph TTFGlyph) glyph characters this)) +(define current-layout-caching (make-parameter #false)) +(define layout-cache (make-hash)) ;; Returns a GlyphRun object, which includes an array of Glyphs and GlyphPositions for the given string. (define/contract (layout this string [userFeatures #f] [script #f] [language #f]) ((string?) ((option/c (listof symbol?)) (option/c symbol?) (option/c symbol?)) . ->*m . GlyphRun?) (unless (· this _layoutEngine) (set-field! _layoutEngine this (+LayoutEngine this))) - #;(report*/file 'in-layout (· this _layoutEngine)) - (send (· this _layoutEngine) layout string userFeatures script language)) + (define (get-layout string) + (define key (list string (and userFeatures (sort userFeatures symbol