subset with composites
parent
c60cde7a16
commit
2514b6493d
Binary file not shown.
@ -0,0 +1,23 @@
|
||||
PDFDocument = require 'pdfkit'
|
||||
fs = require 'fs'
|
||||
|
||||
make = (doc) ->
|
||||
|
||||
# Register a font name for use later
|
||||
doc.registerFont('Charter', 'assets/charter.ttf')
|
||||
|
||||
# Set the font, draw some text
|
||||
doc.font('Charter')
|
||||
.fontSize(25)
|
||||
.text('Åcçénts äre în', 100, 100, {width: false})
|
||||
|
||||
doc.end()
|
||||
|
||||
|
||||
doc = new PDFDocument({compress: no})
|
||||
doc.pipe(fs.createWriteStream('test13.pdf'))
|
||||
make doc
|
||||
|
||||
#doc = new PDFDocument({compress: yes})
|
||||
#doc.pipe(fs.createWriteStream('test12c.pdf'))
|
||||
#make doc
|
Binary file not shown.
@ -0,0 +1,27 @@
|
||||
#lang pitfall/pdftest
|
||||
|
||||
(define-runtime-path charter-path "assets/charter.ttf")
|
||||
|
||||
(define (proc doc)
|
||||
;; Register a font name for use later
|
||||
(send doc registerFont "Charter" (path->string charter-path))
|
||||
|
||||
;; Set the font, draw some text
|
||||
(send* doc
|
||||
[font "Charter"]
|
||||
[fontSize 25]
|
||||
[text "Åcçénts äre în" 100 100 (hash 'width #f)]))
|
||||
|
||||
;; test against non-subsetted font version
|
||||
(define-runtime-path this "test13rkt.pdf")
|
||||
(make-doc this #f proc)
|
||||
|
||||
(define-runtime-path that "test13crkt.pdf")
|
||||
(make-doc that #t proc #:pdfkit #f)
|
||||
|
||||
#;(module+ test
|
||||
(define doc (make-object PDFDocument))
|
||||
(send doc registerFont "Charter" (path->string charter-path))
|
||||
(send* doc [font "Charter"])
|
||||
(send doc pipe (open-output-string))
|
||||
(send doc end))
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue