From 38096fdd480ed18b337550aff01eea577061207b Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sat, 15 Jul 2017 14:35:03 -0700 Subject: [PATCH] test19 (embed otf) --- pitfall/pitfall/test/test19.coffee | 20 ++++++++++++++++++++ pitfall/pitfall/test/test19.rkt | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 pitfall/pitfall/test/test19.coffee create mode 100644 pitfall/pitfall/test/test19.rkt diff --git a/pitfall/pitfall/test/test19.coffee b/pitfall/pitfall/test/test19.coffee new file mode 100644 index 00000000..9b62d8af --- /dev/null +++ b/pitfall/pitfall/test/test19.coffee @@ -0,0 +1,20 @@ +PDFDocument = require 'pdfkit' +fs = require 'fs' + +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(100) + .text('x', 100, 100, {width: false}) + + doc.end() + + +doc = new PDFDocument({compress: no}) +doc.pipe(fs.createWriteStream('test19.pdf')) +make doc + diff --git a/pitfall/pitfall/test/test19.rkt b/pitfall/pitfall/test/test19.rkt new file mode 100644 index 00000000..f0afa049 --- /dev/null +++ b/pitfall/pitfall/test/test19.rkt @@ -0,0 +1,21 @@ +#lang pitfall/pdftest + +;; subset font with GPOS table +(define-runtime-path ttf-path "assets/fira.ttf") + +(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 25] + [text "Hola Hola" 100 100 (hash 'width #f)])) + +;; test against non-subsetted font version +(define-runtime-path this "test14rkt.pdf") +(make-doc this #f proc ) + +(define-runtime-path that "test14crkt.pdf") +(make-doc that #t proc #:pdfkit #f)