cl-typesetting で日本語出力
ちょっと前のことだけど cl-typesetting(CL-PDF)で日本語出力できるようにしてみた。
http://github.com/quek/cl-pdf-jp
かろうじて日本語フォントが使える程度だけど、ないよりはましでしょ?
(eval-when (:compile-toplevel :load-toplevel :execute)
(require :cl-typesetting))
(defpackage :try-cl-typesetting
(:use :cl :typeset))
(in-package :try-cl-typesetting)
(defun hello (&optional (file #P"/tmp/hello.pdf"))
(pdf:with-document ()
(pdf:with-page ()
(pdf:with-outline-level ("Example" (pdf:register-page-reference))
(pdf:set-line-width 0.1)
(let ((content
(compile-text ()
(vspace 100)
(paragraph (:h-align :left :font "GothicBBB-Medium" :font-size 40 :color '(0.0 0 0.8))
"ばーあ。羊は「かる」。ばーばー羊。永い羊。ばーばー羊。永い羊。ばーばー羊。永い羊。ばーばー羊。永い羊。"
:eol
(vspace 2)
(hrule :dy 1)
(with-style (:font "Times-Italic" :font-size 26)
"The cool Common Lisp typesetting system")
(vspace 50)
(with-style (:font "Ryumin-Light" :font-size 30)
"こんにちは、市民!ばくです。")
(with-style (:font "Times-Roman" :font-size 30)
"Hello World!")
(with-style (:font "GothicBBB-Medium" :font-size 30)
"こんにちは、市民!ばくです。")
(with-style (:font "Ryumin-Light" :font-size 30)
"こんにちは、市民!ばくです。")
(vspace 50)
(with-style (:font "Helvetica" :font-size 12)
"hello" (typeset::dotted-hfill) "4.2" :eol
"hello world" (typeset::dotted-hfill) "4.2.4.2"))
(paragraph (:h-align :justified :font "Helvetica" :font-size 12 :color '(0.0 0 0.0))
"hello" (typeset::dotted-hfill) "4.2" :eol
"hello world" (typeset::dotted-hfill) "4.2.4.2")
(vspace 50)
(paragraph (:h-align :justified :font "Helvetica" :font-size 12 :color '(0.0 0 0.0))
"hello" (typeset::dotted-hfill :pattern-spacing 0.6) "4.2" :eol
"hello world" (typeset::dotted-hfill :pattern-spacing 0.6) "4.2.4.2")
(vspace 50)
(paragraph (:h-align :justified :font "Helvetica" :font-size 12 :color '(0.0 0 0.0))
"hello" (typeset::dotted-hfill :char-pattern ".+" :pattern-spacing 0) "4.2" :eol
"hello world" (typeset::dotted-hfill :char-pattern ".+" :pattern-spacing 0) "4.2.4.2"))))
(typeset::draw-block content 20 800 545 700))))
(pdf:write-document file))
(asdf:run-shell-command (format nil "evince ~a" file)))
0 件のコメント:
コメントを投稿