add clustering test
parent
af9bde6aa9
commit
8e1f188b01
Binary file not shown.
@ -0,0 +1,26 @@
|
||||
PDFDocument = require 'pdfkit'
|
||||
fs = require 'fs'
|
||||
|
||||
# embed otf
|
||||
|
||||
make = (doc) ->
|
||||
|
||||
doc.registerFont('sarabun', 'assets/sarabun.ttf')
|
||||
doc.registerFont('fira', 'assets/fira.otf')
|
||||
|
||||
# Set the font, draw some text
|
||||
doc.font('sarabun')
|
||||
.fontSize(40)
|
||||
.text('hello สวัสดีชาวโลก world', 100, 150, {width: false})
|
||||
|
||||
doc.end()
|
||||
|
||||
|
||||
doc = new PDFDocument({compress: no})
|
||||
doc.pipe(fs.createWriteStream('test23.pdf'))
|
||||
make doc
|
||||
|
||||
doc = new PDFDocument({compress: yes})
|
||||
doc.pipe(fs.createWriteStream('test23c.pdf'))
|
||||
make doc
|
||||
|
Binary file not shown.
@ -1,6 +1,23 @@
|
||||
#lang debug racket/base
|
||||
(require fontland/test/index
|
||||
fontland/test/glyphs
|
||||
fontland/test/directory
|
||||
fontland/test/subset)
|
||||
(time (void))
|
||||
(require pitfall/pdftest)
|
||||
|
||||
;; subset OTF font
|
||||
(define-runtime-path sarabun "assets/sarabun.ttf")
|
||||
|
||||
;; embed otf
|
||||
|
||||
(define (proc doc)
|
||||
(register-font doc "sarabun" (path->string sarabun))
|
||||
|
||||
;; Set the font, draw some text
|
||||
[font doc "sarabun"]
|
||||
[font-size doc 40]
|
||||
[text doc "hello สวัสดีชาวโลก world" 100 150])
|
||||
|
||||
;; test against non-subsetted font version
|
||||
(define-runtime-path this "test23rkt.pdf")
|
||||
(make-doc this #f proc)
|
||||
|
||||
(define-runtime-path that "test23crkt.pdf")
|
||||
(make-doc that #t proc)
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
#lang debug racket/base
|
||||
(require fontland/test/index
|
||||
fontland/test/glyphs
|
||||
fontland/test/directory
|
||||
fontland/test/subset)
|
||||
(time (void))
|
Loading…
Reference in New Issue