test20 is now otf embedding

main
Matthew Butterick 7 years ago
parent 26e15f7d76
commit a99be67345

@ -0,0 +1,22 @@
PDFDocument = require 'pdfkit'
fs = require 'fs'
# embed otf
make = (doc) ->
# Register a font name for use later
doc.registerFont('the-font', 'assets/fira.otf')
# Set the font, draw some text
doc.font('the-font')
.fontSize(40)
.text('Embedded OTF', 100, 100, {width: false})
doc.end()
doc = new PDFDocument({compress: no})
doc.pipe(fs.createWriteStream('test20.pdf'))
make doc

Binary file not shown.

@ -0,0 +1,23 @@
#lang pitfall/pdftest
;; subset font with GPOS table
(define-runtime-path ttf-path "assets/fira.otf")
;; embed otf
(define (proc doc)
;; Register a font name for use later
(send doc registerFont "the-font" (path->string ttf-path))
;; Set the font, draw some text
(send* doc
[font "the-font"]
[fontSize 40]
[text "Embedded OTF" 100 100 (hash 'width #f)]))
;; test against non-subsetted font version
(define-runtime-path this "test20rkt.pdf")
(make-doc this #f proc )
(define-runtime-path that "test20crkt.pdf")
(make-doc that #t proc #:pdfkit #f)
Loading…
Cancel
Save