| 1 |
;;; cl-pdf copyright 2002-2005 Marc Battyani see license.txt for the details |
|---|
| 2 |
;;; You can reach me at marc.battyani@fractalconcept.com or marc@battyani.net |
|---|
| 3 |
;;; The homepage of cl-pdf is here: http://www.fractalconcept.com/asp/html/cl-pdf.html |
|---|
| 4 |
|
|---|
| 5 |
(in-package #:pdf) |
|---|
| 6 |
|
|---|
| 7 |
;;; This file contains some special variables which need to be set |
|---|
| 8 |
;;; depending on your Lisp implementation/OS/installation. |
|---|
| 9 |
|
|---|
| 10 |
(defconstant +external-format+ |
|---|
| 11 |
#-(or sbcl lispworks clisp allegro) :default |
|---|
| 12 |
#+sbcl :latin-1 |
|---|
| 13 |
#+(and allegro mswindows) :octets |
|---|
| 14 |
#+(and allegro unix) :default |
|---|
| 15 |
#+lispworks '(:latin-1 :eol-style :lf) |
|---|
| 16 |
#+clisp :unix) |
|---|
| 17 |
|
|---|
| 18 |
#+clisp |
|---|
| 19 |
(setf *default-file-encoding* (ext:make-encoding :charset charset:iso-8859-1)) |
|---|
| 20 |
|
|---|
| 21 |
;; Map exceptional but useful characters to the [0-255] range for a single-byte encoding |
|---|
| 22 |
;; Add more here... |
|---|
| 23 |
(defparameter *char-single-byte-codes* |
|---|
| 24 |
'((#.(code-char #x2013) . #x96) ; En dash: 8211 -> 150 |
|---|
| 25 |
(#.(code-char #x2014) . #x97) ; Em dash: 8212 -> 151 |
|---|
| 26 |
(#.(code-char #x2022) . #xB7) ; Bullet: 8226 -> 183 |
|---|
| 27 |
(#.(code-char #x2026) . #x85) ; Ellipsis: 8230 -> 133 |
|---|
| 28 |
(#.(code-char #x2039) . #x8B) ; Single left angle quotation mark: 8249 -> 139 |
|---|
| 29 |
(#.(code-char #x203A) . #x9B) ; Single right angle quotation mark: 8250 -> 155 |
|---|
| 30 |
(#.(code-char #x2122) . #x99) ; Trademark: 8482 -> 153 |
|---|
| 31 |
(#.(code-char #x00b0) . #xb0) ; Degree sign |
|---|
| 32 |
(#.(code-char #x00b4) . #xb4) ; Actute accent |
|---|
| 33 |
) ) |
|---|
| 34 |
|
|---|
| 35 |
;; Charset for strings mentioned outside content streams, e.g. in outlines. |
|---|
| 36 |
;; See #<method write-object (string &optional root-level)> |
|---|
| 37 |
(defvar *default-charset* |
|---|
| 38 |
#+(and lispworks win32) (ef::ef-coded-character-set win32:*multibyte-code-page-ef*) |
|---|
| 39 |
#-(and lispworks win32) *char-single-byte-codes*) ; last resort |
|---|
| 40 |
|
|---|
| 41 |
(defvar *min-size-for-compression* 300) |
|---|
| 42 |
|
|---|
| 43 |
(defvar *compress-streams* nil |
|---|
| 44 |
"Enables the internal streams compression by zlib") |
|---|
| 45 |
|
|---|
| 46 |
(defvar *embed-fonts* :default |
|---|
| 47 |
"t, nil, or :default (let make-font-dictionary and font-descriptor decide for themselves)") |
|---|
| 48 |
|
|---|
| 49 |
(defvar *compress-fonts* t "nil or decode filter designator") |
|---|
| 50 |
|
|---|
| 51 |
;the cl-pdf base directory |
|---|
| 52 |
(defvar *cl-pdf-base-directory* |
|---|
| 53 |
(make-pathname :name nil :type nil :version nil |
|---|
| 54 |
:defaults #.(or #-gcl *compile-file-truename* *load-truename*)) |
|---|
| 55 |
"The base directory for cl-pdf source and auxiliary data") |
|---|
| 56 |
|
|---|
| 57 |
;; The *afm-files-directories* is only for the 14 predefined fonts. |
|---|
| 58 |
;; other fonts must have their afm files read only when they are loaded |
|---|
| 59 |
;; Rationale for redefinition: |
|---|
| 60 |
;; Neither of the versions of search-for-file can search the original value of |
|---|
| 61 |
;; *afm-files-directories* (#P"cl-pdf/afm/*.afm") as it contains wildcards! |
|---|
| 62 |
(defparameter *afm-files-directories* |
|---|
| 63 |
(list (merge-pathnames #P"afm/" *cl-pdf-base-directory*)) |
|---|
| 64 |
"The list of directories containing the Adobe Font Metrics and other font files. |
|---|
| 65 |
Can be expanded by additionally loaded modules.") |
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
;; define the :pdf-binary feature if your Lisp implementation accepts |
|---|
| 69 |
;; to write binary sequences to character streams |
|---|
| 70 |
;; For LW you need version 4.2.7 minimum |
|---|
| 71 |
#+(or lispworks allegro) |
|---|
| 72 |
(pushnew :pdf-binary *features*) |
|---|
| 73 |
|
|---|
| 74 |
;(eval-when (:compile-toplevel :load-toplevel :execute) |
|---|
| 75 |
#+use-uffi-zlib |
|---|
| 76 |
(defvar *zlib-search-paths* `(,(directory-namestring *load-truename*) |
|---|
| 77 |
#+lispworks |
|---|
| 78 |
,(directory-namestring (lw:lisp-image-name)) |
|---|
| 79 |
"/usr/local/lib/" |
|---|
| 80 |
"/usr/lib/" |
|---|
| 81 |
"/windows/system32/" |
|---|
| 82 |
"/winnt/system32/") |
|---|
| 83 |
"The paths where to search the zlib shared library") |
|---|
| 84 |
|
|---|
| 85 |
;a catchall for various kind of errors that can happen in the generation of a document. |
|---|
| 86 |
; just catch 'max-number-of-pages-reached if you want to do something with this. |
|---|
| 87 |
(defvar *max-number-of-pages* 1000 |
|---|
| 88 |
"The maximum number of pages for a document") |
|---|
| 89 |
|
|---|
| 90 |
(defvar *a4-portrait-page-bounds* #(0 0 595 841)) |
|---|
| 91 |
(defvar *letter-portrait-page-bounds* #(0 0 612 792)) |
|---|
| 92 |
(defvar *a4-landscape-page-bounds* #(0 0 841 595)) |
|---|
| 93 |
(defvar *letter-landscape-page-bounds* #(0 0 792 612)) |
|---|
| 94 |
(defvar *default-page-bounds* *a4-portrait-page-bounds*) |
|---|