diff --git a/fontland/fontland/font.rkt b/fontland/fontland/font.rkt index 3a327a98..82405bda 100644 --- a/fontland/fontland/font.rkt +++ b/fontland/fontland/font.rkt @@ -183,7 +183,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/TTFFont.js ('hb-positions posns)) (define glyphs (for/list ([gidx (in-list gidxs)] [cluster (in-list clusters)]) - (getGlyph this gidx cluster))) + (get-glyph this gidx cluster))) (define positions (for/list ([pos (in-list posns)]) (match pos [(list xad yad xoff yoff _) (+glyph-position xad yad xoff yoff)]))) @@ -264,10 +264,9 @@ https://github.com/mbutterick/fontkit/blob/master/src/TTFFont.js ;; Maps a single unicode code point to a Glyph object. ;; Does not perform any advanced substitutions (there is no context to do so). -(define (glyphForCodePoint this codePoint) - #;(index? . ->m . glyph?) - (define glyph-idx (FT_Get_Char_Index (· this ft-face) codePoint)) - (getGlyph this glyph-idx (list codePoint))) +(define (glyph-for-codepoint this codepoint) + (define glyph-idx (FT_Get_Char_Index (· this ft-face) codepoint)) + (get-glyph this glyph-idx (list codepoint))) (define (measure-char-width this char) diff --git a/fontland/fontland/glyph.rkt b/fontland/fontland/glyph.rkt index 21adacc4..e570e553 100644 --- a/fontland/fontland/glyph.rkt +++ b/fontland/fontland/glyph.rkt @@ -64,8 +64,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/glyph/Glyph.js ;; Returns a glyph object for the given glyph id. ;; You can pass the array of code points this glyph represents for ;; your use later, and it will be stored in the glyph object. -(define (getGlyph this glyph [characters null]) - #;((index?) ((listof index?)) . ->*m . glyph?) +(define (get-glyph this glyph [characters null]) ;; no CFF #;(make-object (if (· this has-cff-table?) CFFGlyph diff --git a/fontland/fontland/subset.rkt b/fontland/fontland/subset.rkt index 15c7f5a6..8f930020 100644 --- a/fontland/fontland/subset.rkt +++ b/fontland/fontland/subset.rkt @@ -74,18 +74,17 @@ https://github.com/mbutterick/fontkit/blob/master/src/subset/TTFSubset.js (define (ttf-subset-add-glyph ss gid) - (define glyph (getGlyph (subset-font ss) gid)) - - ;; glyph-decode unpacks the `glyf` table data corresponding to a certin gid. ;; here, it's not necessary for non-composite glyphs ;; because they just get copied entirely into the subset. ;; it's just used to detect composite glyphs and handle them specially. ;; so an optimization would be to detect composite / noncomposite without full glyph-decode. + (define glyph (get-glyph (subset-font ss) gid)) (define ttf-glyf-data (glyph-decode glyph)) ;; get the offset to the glyph from the loca table - (match-define (list this-offset next-offset) (take (drop (hash-ref (dump (get-table (subset-font ss) 'loca)) 'offsets) gid) 2)) + (match-define (list this-offset next-offset) + (take (drop (hash-ref (dump (get-table (subset-font ss) 'loca)) 'offsets) gid) 2)) (define port (get-table-stream (subset-font ss) 'glyf)) (pos port (+ (pos port) this-offset))