main
Matthew Butterick 7 years ago
parent eb2a5715e2
commit 26e15f7d76

@ -28,7 +28,9 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GlyphInfo.js
[cursiveAttachment #f]
[markattachment #f]
[shaperInfo #f]
[substituted #f])
[substituted #f]
[isMark #f]
[isLigature #f])
(define/public (id [id-in #f])
(cond

@ -1,15 +1,18 @@
PDFDocument = require 'pdfkit'
fs = require 'fs'
# test ss03 (alternate ampersand form)
make = (doc) ->
# Register a font name for use later
doc.registerFont('the-font', 'assets/fira.otf')
doc.registerFont('the-font', 'assets/fira.ttf')
# Set the font, draw some text
doc.font('the-font')
.fontSize(100)
.text('x', 100, 100, {width: false})
.text('A&B', 100, 100, {width: false})
.text('X&Y', 100, 200, {width: false, features: ["ss03"]})
doc.end()

Binary file not shown.

@ -3,6 +3,8 @@
;; subset font with GPOS table
(define-runtime-path ttf-path "assets/fira.ttf")
; test ss03 (alternate ampersand form)
(define (proc doc)
;; Register a font name for use later
(send doc registerFont "the-font" (path->string ttf-path))
@ -10,12 +12,13 @@
;; Set the font, draw some text
(send* doc
[font "the-font"]
[fontSize 25]
[text "Hola Hola" 100 100 (hash 'width #f)]))
[fontSize 100]
[text "A&B" 100 100 (hash 'width #f)]
[text "X&Y" 100 200 (hash 'width #f 'features '(ss03))]))
;; test against non-subsetted font version
(define-runtime-path this "test14rkt.pdf")
(make-doc this #f proc )
(define-runtime-path this "test19rkt.pdf")
(make-doc this #f proc)
(define-runtime-path that "test14crkt.pdf")
(define-runtime-path that "test19crkt.pdf")
(make-doc that #t proc #:pdfkit #f)

Loading…
Cancel
Save