diff --git a/pitfall/ptest/test20.coffee b/pitfall/ptest/test20.coffee index b0fbd658..27e23ed1 100644 --- a/pitfall/ptest/test20.coffee +++ b/pitfall/ptest/test20.coffee @@ -6,10 +6,11 @@ fs = require 'fs' make = (doc) -> # Register a font name for use later - doc.registerFont('the-font', 'assets/fira.otf') + doc.registerFont('fira', 'assets/fira.otf') + doc.registerFont('charter', 'assets/charter.otf') # Set the font, draw some text - doc.font('the-font') + doc.font('fira') .fontSize(40) .text('Fira OTF rifle fire', 100, 100, {width: false}) @@ -20,7 +21,7 @@ doc = new PDFDocument({compress: no}) doc.pipe(fs.createWriteStream('test20.pdf')) make doc -#doc = new PDFDocument({compress: yes}) -#doc.pipe(fs.createWriteStream('test20c.pdf')) -#make doc +doc = new PDFDocument({compress: yes}) +doc.pipe(fs.createWriteStream('test20c.pdf')) +make doc diff --git a/pitfall/ptest/test20.pdf b/pitfall/ptest/test20.pdf index 35d652eb..9cdddca3 100644 Binary files a/pitfall/ptest/test20.pdf and b/pitfall/ptest/test20.pdf differ diff --git a/pitfall/ptest/test20.rkt b/pitfall/ptest/test20.rkt index c0832ec0..0f037c5c 100644 --- a/pitfall/ptest/test20.rkt +++ b/pitfall/ptest/test20.rkt @@ -2,22 +2,24 @@ (require pitfall/pdftest) ;; subset OTF font -(define-runtime-path otf-path "assets/fira.otf") +(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 "the-font" (path->string otf-path)) + (register-font doc "fira" (path->string fira)) + (register-font doc "charter" (path->string charter)) ;; Set the font, draw some text - [font doc "the-font"] + [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 #:test #f) +(make-doc this #f proc) -#;(define-runtime-path that "test20crkt.pdf") -#;(make-doc that #t proc #:pdfkit #f) +(define-runtime-path that "test20crkt.pdf") +(make-doc that #t proc) diff --git a/pitfall/ptest/test20c.pdf b/pitfall/ptest/test20c.pdf index 62459e04..de5ed222 100644 Binary files a/pitfall/ptest/test20c.pdf and b/pitfall/ptest/test20c.pdf differ diff --git a/pitfall/ptest/test20crkt copy.pdf b/pitfall/ptest/test20crkt copy.pdf new file mode 100644 index 00000000..095de421 Binary files /dev/null and b/pitfall/ptest/test20crkt copy.pdf differ diff --git a/pitfall/ptest/test20rkt copy.pdf b/pitfall/ptest/test20rkt copy.pdf new file mode 100644 index 00000000..607556b7 Binary files /dev/null and b/pitfall/ptest/test20rkt copy.pdf differ diff --git a/pitfall/ptest/test21.coffee b/pitfall/ptest/test21.coffee new file mode 100644 index 00000000..38a55cb9 --- /dev/null +++ b/pitfall/ptest/test21.coffee @@ -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 + diff --git a/pitfall/ptest/test21.pdf b/pitfall/ptest/test21.pdf new file mode 100644 index 00000000..150295e0 Binary files /dev/null and b/pitfall/ptest/test21.pdf differ diff --git a/pitfall/ptest/test21.rkt b/pitfall/ptest/test21.rkt new file mode 100644 index 00000000..0f037c5c --- /dev/null +++ b/pitfall/ptest/test21.rkt @@ -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) diff --git a/pitfall/ptest/test21c.pdf b/pitfall/ptest/test21c.pdf new file mode 100644 index 00000000..f0fbd1be Binary files /dev/null and b/pitfall/ptest/test21c.pdf differ diff --git a/pitfall/ptest/test21crkt copy.pdf b/pitfall/ptest/test21crkt copy.pdf new file mode 100644 index 00000000..240ecbc9 Binary files /dev/null and b/pitfall/ptest/test21crkt copy.pdf differ diff --git a/pitfall/ptest/test21rkt copy.pdf b/pitfall/ptest/test21rkt copy.pdf new file mode 100644 index 00000000..5c944681 Binary files /dev/null and b/pitfall/ptest/test21rkt copy.pdf differ