more renames

main
Matthew Butterick 6 years ago
parent 943b3cf785
commit 1e73c9555b

@ -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)

@ -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

@ -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))

Loading…
Cancel
Save