main
Matthew Butterick 5 years ago
parent 66eb67fcb6
commit e838e89ef4

@ -84,7 +84,7 @@ https://github.com/mbutterick/pdfkit/blob/master/lib/font/embedded.coffee
(scale-glyph-position! posn scale)
(values subset-idx posn)))
(list subset-idxs new-positions))
(list (list->vector subset-idxs) (list->vector new-positions)))
(define/override (embed)

@ -63,14 +63,13 @@
(hash-ref @kern-pairs (make-kern-table-key left right) 0))
(define/override (encode text [options #f])
(define encoded (for/list ([c (in-string text)])
(define encoded (for/vector ([c (in-string text)])
(define cint (char->integer c))
(number->string (hash-ref win-ansi-table cint cint) 16)))
(define glyphs (glyphs-for-string text))
(define positions
(for/list ([glyph (in-list glyphs)]
[advance (in-list (advances-for-glyphs glyphs))])
(+glyph-position advance 0 0 0 (glyph-width glyph))))
(define positions (for/vector ([glyph (in-list glyphs)]
[advance (in-list (advances-for-glyphs glyphs))])
(+glyph-position advance 0 0 0 (glyph-width glyph))))
(list encoded positions))
(define/override (string-width str size [options #f])

@ -84,7 +84,7 @@ https://github.com/mbutterick/pdfkit/blob/master/lib/mixins/text.coffee
;; 180321: the first call to this operation is very slow from Quad
;; 181126: because `encode` calls `layout`
(match-define (list encoded-char-strs positions)
(map list->vector (send ($doc-current-font doc) encode text (hash-ref options 'features #f))))
(send ($doc-current-font doc) encode text (hash-ref options 'features #f)))
(define scale (/ ($doc-current-font-size doc) 1000.0))
(define commands empty)

Loading…
Cancel
Save