From jcm at FreeBSD-uk.eu.org Mon Apr 17 13:02:25 2006 From: jcm at FreeBSD-uk.eu.org (Jonathon McKitrick) Date: Mon, 17 Apr 2006 14:02:25 +0100 Subject: [cl-pdf-devel] Copyright and Trademark characters Message-ID: <20060417130225.GA58939@dogma.freebsd-uk.eu.org> Am I missing something really simple trying to insert these characters? The pdf itself comes out with an 'A' with a carat over it and then the character I want. I'm using shift-alt-0 for copyright and alt-e for trademark. -Jonathon -- "I am sure that Jesus would use a command prompt. Hello? Ten Commandments??" From marc.battyani at fractalconcept.com Mon Apr 17 13:27:54 2006 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Mon, 17 Apr 2006 15:27:54 +0200 Subject: [cl-pdf-devel] Copyright and Trademark characters References: <20060417130225.GA58939@dogma.freebsd-uk.eu.org> Message-ID: <0ae801c66222$bbe699e0$1402a8c0@marcx2> "Jonathon McKitrick" wrote: > Am I missing something really simple trying to insert these characters? > The > pdf itself comes out with an 'A' with a carat over it and then the > character I > want. I'm using shift-alt-0 for copyright and alt-e for trademark. It depends of the encoding used in the pdf font. You can look at the encodings or you can write a program to output a code=>character table to see what is the code of a given character. Marc From jcm at FreeBSD-uk.eu.org Mon Apr 17 13:47:04 2006 From: jcm at FreeBSD-uk.eu.org (Jonathon McKitrick) Date: Mon, 17 Apr 2006 14:47:04 +0100 Subject: [cl-pdf-devel] Inserting bold text during normal text Message-ID: <20060417134704.GB61866@dogma.freebsd-uk.eu.org> Here's another question. My client wants a couple of lines in a report to be in bold, but I have the entire page as raw text in a database. There was a php pdf library that would let me embed html style tags to bold certain lines. Is there anything like that in cl-pdf, where I can store tags in the database text and have the text in between generated in bold, italics, etc? Or is there some other way than rolling my own tag parser? Jonathon McKitrick -- My other computer is your Windows box. From jcm at FreeBSD-uk.eu.org Mon Apr 17 13:36:24 2006 From: jcm at FreeBSD-uk.eu.org (Jonathon McKitrick) Date: Mon, 17 Apr 2006 14:36:24 +0100 Subject: [cl-pdf-devel] Copyright and Trademark characters In-Reply-To: <0ae801c66222$bbe699e0$1402a8c0@marcx2> References: <20060417130225.GA58939@dogma.freebsd-uk.eu.org> <0ae801c66222$bbe699e0$1402a8c0@marcx2> Message-ID: <20060417133624.GA61866@dogma.freebsd-uk.eu.org> On Mon, Apr 17, 2006 at 03:27:54PM +0200, Marc Battyani wrote: : It depends of the encoding used in the pdf font. You can look at the : encodings or you can write a program to output a code=>character table to : see what is the code of a given character. Once I find the encoding, how do I output a raw character code in the middle of a stream of text? Jonathon McKitrick -- My other computer is your Windows box. From david.cooper at genworks.com Mon Apr 17 13:25:37 2006 From: david.cooper at genworks.com (David J Cooper Jr) Date: Mon, 17 Apr 2006 09:25:37 -0400 Subject: [cl-pdf-devel] Copyright and Trademark characters In-Reply-To: <20060417130225.GA58939@dogma.freebsd-uk.eu.org> References: <20060417130225.GA58939@dogma.freebsd-uk.eu.org> Message-ID: <6222a74b0604170625j7ee202b1ic591cfd198bfd8b9@mail.gmail.com> Hi Jonathan, I have been using Edi Weitz' cl-interpol to make constants for all the common symbol characters I need, then insert them with typeset:put-string. You can get the character codes for all the symbols from any of the recent Adobe PDF specs. -dave On 4/17/06, Jonathon McKitrick wrote: > Am I missing something really simple trying to insert these characters? The > pdf itself comes out with an 'A' with a carat over it and then the character I > want. I'm using shift-alt-0 for copyright and alt-e for trademark. > > -Jonathon > -- > "I am sure that Jesus would use a command prompt. Hello? Ten Commandments??" > _______________________________________________ > cl-pdf-devel site list > cl-pdf-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cl-pdf-devel > From marc.battyani at fractalconcept.com Mon Apr 17 13:55:49 2006 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Mon, 17 Apr 2006 15:55:49 +0200 Subject: [cl-pdf-devel] Copyright and Trademark characters References: <20060417130225.GA58939@dogma.freebsd-uk.eu.org> <0ae801c66222$bbe699e0$1402a8c0@marcx2> <20060417133624.GA61866@dogma.freebsd-uk.eu.org> Message-ID: <0af401c66226$a22830a0$1402a8c0@marcx2> "Jonathon McKitrick" wrote: > On Mon, Apr 17, 2006 at 03:27:54PM +0200, Marc Battyani wrote: > : It depends of the encoding used in the pdf font. You can look at the > : encodings or you can write a program to output a code=>character table > to > : see what is the code of a given character. > > Once I find the encoding, how do I output a raw character code in the > middle > of a stream of text? #'code-char Marc From marc.battyani at fractalconcept.com Mon Apr 17 13:58:10 2006 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Mon, 17 Apr 2006 15:58:10 +0200 Subject: [cl-pdf-devel] Inserting bold text during normal text References: <20060417134704.GB61866@dogma.freebsd-uk.eu.org> Message-ID: <0b0301c66226$f630cb30$1402a8c0@marcx2> "Jonathon McKitrick" wrote: > Here's another question. My client wants a couple of lines in a report to > be > in bold, but I have the entire page as raw text in a database. There was > a > php pdf library that would let me embed html style tags to bold certain > lines. > > Is there anything like that in cl-pdf, where I can store tags in the > database > text and have the text in between generated in bold, italics, etc? Or is > there some other way than rolling my own tag parser? There is an HTML to cl-typesetting front-end in the contrib directory of cl-typesetting. BTW to layout text you need cl-typesetting above cl-pdf Marc From marc.battyani at fractalconcept.com Mon Apr 17 14:08:28 2006 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Mon, 17 Apr 2006 16:08:28 +0200 Subject: [cl-pdf-devel] Inserting bold text during normal text References: <20060417134704.GB61866@dogma.freebsd-uk.eu.org> <0afc01c66226$eb35d1d0$1402a8c0@marcx2> <20060417140031.GC61866@dogma.freebsd-uk.eu.org> Message-ID: <0b3b01c66228$66613ba0$1402a8c0@marcx2> "Jonathon McKitrick" wrote: > On Mon, Apr 17, 2006 at 03:57:51PM +0200, Marc Battyani wrote: > : There is an HTML to cl-typesetting front-end in the contrib directory of > : cl-typesetting. > : BTW to layout text you need cl-typesetting above cl-pdf > > That's one of my plans: to migrate to cl-typesetting. It seemed like > overkill > at first, but now it's looking more and more necessary. Is it a steep > learning curve or is there a lot of overhead/bookkeeping? Well the doc is like the cl-pdf one... ;-) > Can I use > cl-typesetting on one page and plain cl-pdf on the next? Yes, you can mix cl-typesetting/cl-pdf stuff as you want, even on a same page. Marc From jcm at FreeBSD-uk.eu.org Mon Apr 17 14:11:07 2006 From: jcm at FreeBSD-uk.eu.org (Jonathon McKitrick) Date: Mon, 17 Apr 2006 15:11:07 +0100 Subject: [cl-pdf-devel] Inserting bold text during normal text In-Reply-To: <0b3b01c66228$66613ba0$1402a8c0@marcx2> References: <20060417134704.GB61866@dogma.freebsd-uk.eu.org> <0afc01c66226$eb35d1d0$1402a8c0@marcx2> <20060417140031.GC61866@dogma.freebsd-uk.eu.org> <0b3b01c66228$66613ba0$1402a8c0@marcx2> Message-ID: <20060417141107.GD61866@dogma.freebsd-uk.eu.org> On Mon, Apr 17, 2006 at 04:08:28PM +0200, Marc Battyani wrote: : Well the doc is like the cl-pdf one... ;-) That good, eh? ;-P : Yes, you can mix cl-typesetting/cl-pdf stuff as you want, even on a same : page. Excellent. That would be very helpful. I'll try to get around to migrating soon. Jonathon McKitrick -- My other computer is your Windows box. From peter at gigamonkeys.com Sat Apr 29 04:09:02 2006 From: peter at gigamonkeys.com (Peter Seibel) Date: Fri, 28 Apr 2006 21:09:02 -0700 Subject: [cl-pdf-devel] Patch to quiet warnings Message-ID: I got tired of my life being cluttered up with warnings when I built cl-pdf so I fixed them. Here's the patch. Next up, silencing cl- typesetting. -Peter Index: pdf.lisp =================================================================== --- pdf.lisp (revision 118) +++ pdf.lisp (working copy) @@ -23,8 +23,6 @@ (defgeneric make-dictionary (thing &key &allow-other-keys)) -(defgeneric font-descriptor (font-metrics &key embed errorp)) - (defclass dictionary () ((dict-values :accessor dict-values :initform nil :initarg :dict- values))) Index: defpackage.lisp =================================================================== --- defpackage.lisp (revision 118) +++ defpackage.lisp (working copy) @@ -43,4 +43,10 @@ #:load-t1-font #:load-ttu-font #:encoding #:get-encoding #:draw-bar-code128 #:*page-number* #:test-template #:make-template-from-page #:add-templates-to- page #:draw-template + + ;; pdf-parser + #:insert-original-page-content + #:with-existing-document + #:with-existing-page + )) Index: ttu-font.lisp =================================================================== --- ttu-font.lisp (revision 118) +++ ttu-font.lisp (working copy) @@ -21,7 +21,7 @@ (length1 :accessor length1))) (defmethod font-type ((fm ttu-font-metrics)) - (declare (ignore fm)) + #-allegro(declare (ignore fm)) "Type0") (defun load-ttu-font (ufm-file &optional ttf-file) @@ -39,6 +39,7 @@ (defmethod font-descriptor ((fm ttu-font-metrics) &key (embed *embed-fonts*) (errorp t)) + (declare (ignore errorp)) (flet ((conv-dim (d) (round (* 1000 d)))) (make-instance 'indirect-object @@ -106,6 +107,7 @@ (defmethod make-dictionary ((fm ttu-font-metrics) &key font (encoding (encoding font)) (embed *embed-fonts*)) + (declare (ignore encoding)) (let* ((font-descriptor (font-descriptor fm :embed embed :errorp nil)) (cid-font (make-instance 'cid-font Index: t1-font.lisp =================================================================== --- t1-font.lisp (revision 118) +++ t1-font.lisp (working copy) @@ -55,6 +55,7 @@ (defmethod font-descriptor ((t1fm t1-font-metrics) &key (embed *embed-fonts*) (errorp t)) + (declare (ignore errorp)) (flet ((conv-dim (d) (round (* 1000 d)))) (make-instance 'indirect-object :content (make-instance 'dictionary ;:obj-number 0 :no-link t Index: chart.lisp =================================================================== --- chart.lisp (revision 118) +++ chart.lisp (working copy) @@ -89,7 +89,7 @@ (height axis)) (defmethod draw-object (obj) - ) + (declare (ignore obj))) (defun nice-number (n approx integer-p) (let* ((n10 (expt 10 (floor (log n 10)))) @@ -303,14 +303,14 @@ for bx from gx by group-width do (loop for y = 0.0 then (+ y dy) for value in values - for (name color) in (labels&colors obj) + for (nil color) in (labels&colors obj) for dy = (* value scale) do (apply #'set-rgb-fill color) (basic-rect bx y bar-width dy) (fill-and-stroke))) (loop for serie in (series obj) for gx from (* 0.5 spacing) by bar-width - for (name color) in (labels&colors obj) do + for (nil color) in (labels&colors obj) do (apply #'set-rgb-fill color) (loop for value in serie for dy = (* (- value min-value) scale) @@ -351,7 +351,7 @@ (apply #'set-rgb-fill (background-color obj)) (fill-and-stroke) (loop for angle in angles - for (name color) in (labels&colors obj) + for (nil color) in (labels&colors obj) for start = 0 then end for end = (+ start angle) do (apply #'set-rgb-fill color) @@ -473,7 +473,7 @@ (stroke)) (set-line-width (line-width obj)) (loop for serie in (series obj) - for (name color) in (labels&colors obj) do + for (nil color) in (labels&colors obj) do (apply #'set-rgb-stroke color) (apply #'set-rgb-fill color) (let ((points '()) Index: pdf-parser.lisp =================================================================== --- pdf-parser.lisp (revision 118) +++ pdf-parser.lisp (working copy) @@ -118,8 +118,8 @@ (defun read-object (&optional (eof-error-p t)) "Returns one of the following PDF objects: boolean (:true or :false), number (Lisp number), string (Lisp string), name (Lisp symbol in the PDF -package), array (Lisp vector), dictionary (Lisp property list), stream -(Lisp pdf-stream) or null (Lisp NIL). When EOF-ERRORP is nil, it returns +package), array (Lisp vector), dictionary (Lisp property list), stream (Lisp +pdf-stream) or null (Lisp NIL). When EOF-ERRORP is nil, it returns :eof for the end of the stream (otherwise it signals an error)." (skip-whitespace eof-error-p) (let ((char (peek-char nil *pdf-input-stream* eof-error-p))) @@ -259,7 +259,7 @@ (otherwise (push (read-object t) plist))))) - (loop for (k v . rest) on (nreverse plist) by #'cddr + (loop for (k v) on (nreverse plist) by #'cddr collect (cons k v)))) (defun read-dictionary () @@ -314,6 +314,7 @@ (file-position *pdf-input-stream* file-position) (let* ((object-number (read-integer)) (generation-number (read-integer))) + (declare (ignore object-number generation-number)) (eat-keyword "obj") (let ((object (read-object))) ;; Some producers forget the "endobj" at the end of a stream @@ -426,6 +427,7 @@ (defun read-pdf () (let* ((trailer (read-xref-and-trailer (find-cross-reference- start))) (%visited-object% (make-hash-table :test #'eql))) + (declare (ignore %visited-object%)) (setf (catalog *document*) (get-dict-value trailer "/Root") (docinfo *document*) (get-dict-value trailer "/Info")) (load-all-indirect-objects) @@ -456,8 +458,6 @@ ;; restore graphics state (write-line " Q" *page-stream*)) -(export 'insert-original-page-content) - (defun ensure-dictionary (obj) (if (typep obj 'indirect-object) (content obj) @@ -498,8 +498,6 @@ :title ,title :subject ,subject :keywords ,keywords) , at body)) -(export 'with-existing-document) - (defmacro with-existing-page ((page-number) &body body) `(let* ((*original-content* nil) (*current-content* nil) @@ -513,8 +511,6 @@ (get-output-stream-string pdf::*page-stream*))) *current-content*))))) -(export 'with-existing-page) - #| (pdf:with-existing-document (#P"/tmp/MS-32.pdf") Index: font.lisp =================================================================== --- font.lisp (revision 118) +++ font.lisp (working copy) @@ -17,6 +17,8 @@ (defvar *compress-fonts* t "nil or decode filter designator") +(defvar *font-metrics* (make-hash-table :test #'equal)) + (defgeneric font-descriptor (font-metrics &key embed errorp)) (defclass font () @@ -148,5 +150,3 @@ (clear-font-cache) (setf %fonts-loaded% t))) -(eval-when (:load-toplevel :execute) - (load-fonts)) Index: encodings.lisp =================================================================== --- encodings.lisp (revision 118) +++ encodings.lisp (working copy) @@ -42,29 +42,8 @@ (defun get-encoding (encoding-designator) (gethash encoding-designator *encodings*)) -(defun compute-encoding-differences (encoding &optional (from *standard-encoding*)) - (let ((differences (make-array 20 :fill-pointer 0 :adjustable t)) - (range-started nil)) - (if from - (flet ((start-range (code) - (when (or (and code (not range-started))(and (not code) range- started)) - (setf range-started code) - (when code (vector-push-extend code differences))))) - (loop with start-code = nil - for standard-char-name across (char-names from) - for char-name across (char-names encoding) - for code from 0 - do - (cond - ((and (not char-name) standard-char-name) - (start-range code) (vector-push-extend ".notdef" differences)) - ((and char-name (not (equal char-name standard-char-name))) - (start-range code) - (vector-push-extend (add-/ char-name) differences)) - (t (start-range nil))))) - (full-encoding-differences encoding)) - differences)) + ;;; Just put all... (defun full-encoding-differences (encoding) (let ((differences (make-array 20 :fill-pointer 0 :adjustable t))) @@ -411,3 +390,26 @@ "escyrillic" "tecyrillic" "ucyrillic" "efcyrillic" "khacyrillic" "tsecyrillic" "checyrillic" "shacyrillic" "shchacyrillic" "hardsigncyrillic" "yericyrillic" "softsigncyrillic" "ereversedcyrillic" "iucyrillic" "iacyrillic"))) + + +(defun compute-encoding-differences (encoding &optional (from *standard-encoding*)) + (let ((differences (make-array 20 :fill-pointer 0 :adjustable t)) + (range-started nil)) + (if from + (flet ((start-range (code) + (when (or (and code (not range-started))(and (not code) range- started)) + (setf range-started code) + (when code (vector-push-extend code differences))))) + (loop for standard-char-name across (char-names from) + for char-name across (char-names encoding) + for code from 0 + do + (cond + ((and (not char-name) standard-char-name) + (start-range code) (vector-push-extend ".notdef" differences)) + ((and char-name (not (equal char-name standard-char-name))) + (start-range code) + (vector-push-extend (add-/ char-name) differences)) + (t (start-range nil))))) + (full-encoding-differences encoding)) + differences)) \ No newline at end of file Index: font-metrics.lisp =================================================================== --- font-metrics.lisp (revision 118) +++ font-metrics.lisp (working copy) @@ -6,8 +6,6 @@ ;;Many thanks to Alexey Dejneka (adejneka at comail.ru) who finished the parsing of the AFM files. -(defvar *font-metrics* (make-hash-table :test #'equal)) - (defclass char-metrics () ((code :accessor code :initarg :code) (name :accessor name :initarg :name) @@ -293,7 +291,7 @@ (with-open-file (s filename :direction :input :external-format +external-format+) (setf font-metrics (afm-font-metrics s font-metrics-class))) (setf void-char (gethash "VoidCharacter" (characters font- metrics))) - (iter (for (name char-metrics) in-hashtable (characters font- metrics)) + (iter (for (nil char-metrics) in-hashtable (characters font- metrics)) (for gid = (index char-metrics)) (for code = (code char-metrics)) (when (and (<= 0 code #xfffe)) @@ -307,7 +305,7 @@ (vector-push-extend (vector (round (* 1000 (width char- metrics)))) (cid-widths font-metrics)))) (setf encoding-vector (make-array (1+ max-code) :initial- element void-char) pdf-widths (make-array (1+ max-code) :initial-element 0)) - (iter (for (name char-metrics) in-hashtable (characters font- metrics)) + (iter (for (nil char-metrics) in-hashtable (characters font- metrics)) (for code = (code char-metrics)) (when (<= min-code code max-code) (setf (aref encoding-vector code) char-metrics Index: pdf-base.lisp =================================================================== --- pdf-base.lisp (revision 118) +++ pdf-base.lisp (working copy) @@ -320,6 +320,7 @@ args)) (defmethod make-image ((jpeg jpeg-image) &key type) + (declare (ignore type)) (make-instance 'pdf:image :bits (data jpeg) :width (width jpeg) :height (height jpeg) Index: png.lisp =================================================================== --- png.lisp (revision 118) +++ png.lisp (working copy) @@ -119,6 +119,7 @@ ;; For color key masking, the Mask entry is an array of 2*N integers, ;; [min1 max1 ? minN maxN], where N is the number of color components in the ;; image's color space. + (declare (ignore type)) (let* ((nb-components (nb-components png)) (palette (palette png)) (lookup Index: iterate/package.lisp =================================================================== --- iterate/package.lisp (revision 118) +++ iterate/package.lisp (working copy) @@ -31,6 +31,7 @@ with while until adjoining nconcing appending nunioning unioning reducing accumulate accumulating)) -(export +clause-names+ '#:iterate) +(eval-when (:compile-toplevel :load-toplevel :execute) + (export +clause-names+ '#:iterate)) ;;; arch-tag: "b8bb0bb6-313c-11d8-abb9-000c76244c24" Index: zlib.lisp =================================================================== --- zlib.lisp (revision 118) +++ zlib.lisp (working copy) @@ -81,6 +81,7 @@ #+use-salza-zlib (defun load-zlib (&optional force) + (declare (ignore force)) (setf *compress-streams* t)) #+use-salza-zlib Index: cl-pdf.asd =================================================================== --- cl-pdf.asd (revision 118) +++ cl-pdf.asd (working copy) @@ -42,12 +42,12 @@ :components ((:file "defpackage") (:file "config" :depends-on ("defpackage")) #+use-uffi-zlib (:file "init" :depends-on ("config")) - (:file "zlib" :depends-on ("defpackage" #+use-uffi-zlib "init")) - (:file "font-metrics" :depends-on ("config")) + (:file "zlib" :depends-on ("defpackage" "config" #+use-uffi- zlib "init")) + (:file "font-metrics" :depends-on ("config" "font")) (:file "encodings" :depends-on ("defpackage")) - (:file "t1-font" :depends-on ("font-metrics" "encodings")) + (:file "t1-font" :depends-on ("font" "font-metrics" "encodings")) (:file "ttu-font" :depends-on ("font-metrics")) - (:file "font" :depends-on ("t1-font")) + (:file "font" :depends-on ("encodings")) (:file "pdf" :depends-on ("font")) (:file "x11-colors" :depends-on ("defpackage")) (:file "pdf-base" :depends-on ("pdf" "x11-colors")) @@ -55,5 +55,6 @@ (:file "pdf-geom" :depends-on ("pdf-base")) (:file "text" :depends-on ("pdf-base")) (:file "bar-codes" :depends-on ("pdf-geom")) - (:file "chart" :depends-on ("text" "pdf-geom"))) + (:file "chart" :depends-on ("text" "pdf-geom" "load-fonts")) + (:file "load-fonts" :depends-on ("defpackage" "font-metrics"))) :depends-on (:iterate #+use-salza-zlib :salza)) -- Peter Seibel * peter at gigamonkeys.com Gigamonkeys Consulting * http://www.gigamonkeys.com/ Practical Common Lisp * http://www.gigamonkeys.com/book/