tests 20 & 21
parent
5a10976df7
commit
8a693b30af
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,27 @@
|
|||||||
|
PDFDocument = require 'pdfkit'
|
||||||
|
fs = require 'fs'
|
||||||
|
|
||||||
|
# embed otf
|
||||||
|
|
||||||
|
make = (doc) ->
|
||||||
|
|
||||||
|
# Register a font name for use later
|
||||||
|
doc.registerFont('fira', 'assets/fira.otf')
|
||||||
|
doc.registerFont('charter', 'assets/charter.otf')
|
||||||
|
|
||||||
|
# Set the font, draw some text
|
||||||
|
doc.font('charter')
|
||||||
|
.fontSize(40)
|
||||||
|
.text('Charter OTF rifle fire', 100, 100, {width: false})
|
||||||
|
|
||||||
|
doc.end()
|
||||||
|
|
||||||
|
|
||||||
|
doc = new PDFDocument({compress: no})
|
||||||
|
doc.pipe(fs.createWriteStream('test21.pdf'))
|
||||||
|
make doc
|
||||||
|
|
||||||
|
doc = new PDFDocument({compress: yes})
|
||||||
|
doc.pipe(fs.createWriteStream('test21c.pdf'))
|
||||||
|
make doc
|
||||||
|
|
Binary file not shown.
@ -0,0 +1,25 @@
|
|||||||
|
#lang debug racket/base
|
||||||
|
(require pitfall/pdftest)
|
||||||
|
|
||||||
|
;; subset OTF font
|
||||||
|
(define-runtime-path fira "assets/fira.otf")
|
||||||
|
(define-runtime-path charter "assets/charter.otf")
|
||||||
|
|
||||||
|
;; embed otf
|
||||||
|
|
||||||
|
(define (proc doc)
|
||||||
|
;; Register a font name for use later
|
||||||
|
(register-font doc "fira" (path->string fira))
|
||||||
|
(register-font doc "charter" (path->string charter))
|
||||||
|
|
||||||
|
;; Set the font, draw some text
|
||||||
|
[font doc "fira"]
|
||||||
|
[font-size doc 40]
|
||||||
|
[text doc "Fira OTF rifle fire" 100 100])
|
||||||
|
|
||||||
|
;; 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)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue