From kw at w-m-p.com Thu Dec 18 16:28:51 2003 From: kw at w-m-p.com (Klaus Weidner) Date: Thu, 18 Dec 2003 10:28:51 -0600 Subject: [cl-typesetting-devel] Re: [cl-typesetting-announce] cl-typesetting at work! In-Reply-To: <01ce01c3c4f0$37529520$0303a8c0@marc2> References: <01ce01c3c4f0$37529520$0303a8c0@marc2> Message-ID: <20031218162850.GB9571@w-m-p.com> On Wed, Dec 17, 2003 at 11:50:48PM +0100, Marc Battyani wrote: > David J Cooper Jr used cl-typesetting and cl-pdf to typeset a nice GDL > pamphlet. > > Here it is: > http://www.genworks.com/downloads/gdl-pamphlet-portrait.pdf That is very impressive. Was this all done in hand-edited Lisp code or did he use a front end to do it? One thing I noticed is that xpdf 2.03 has trouble with the fonts, which apparently have a modified width, resulting in characters being printed on top of one another. Since acroread 5 displays it fine, this is likely to be a bug in xpdf. -Klaus From peter at javamonkey.com Thu Dec 18 18:11:21 2003 From: peter at javamonkey.com (Peter Seibel) Date: Thu, 18 Dec 2003 18:11:21 -0000 Subject: [cl-typesetting-devel] Re: [cl-typesetting-announce] cl-typesetting at work! In-Reply-To: <20031218162850.GB9571@w-m-p.com> References: <01ce01c3c4f0$37529520$0303a8c0@marc2> <20031218162850.GB9571@w-m-p.com> Message-ID: Klaus Weidner writes: > On Wed, Dec 17, 2003 at 11:50:48PM +0100, Marc Battyani wrote: > > David J Cooper Jr used cl-typesetting and cl-pdf to typeset a nice GDL > > pamphlet. > > > > Here it is: > > http://www.genworks.com/downloads/gdl-pamphlet-portrait.pdf > > That is very impressive. Was this all done in hand-edited Lisp code or > did he use a front end to do it? > > One thing I noticed is that xpdf 2.03 has trouble with the fonts, > which apparently have a modified width, resulting in characters > being printed on top of one another. Since acroread 5 displays it > fine, this is likely to be a bug in xpdf. Hmmm. I noticed that to so I printed it, hoping that would clear things up. No dice. Of course I have no idea how printing really works; I'm using CUPS on a GNU/Linux box printing to a hp LaserJet 2200d--for all I know the same code is being used to convert from PDF to Postscript as xpdf uses to render. Marc, can you give a 30 second overview of how fonts work in cl-pdf, cl-typesetting, or PDF generally? For instance, is all the font data embedded in a PDF document? If so where does it come from? If not, how are the fonts supposed to be found when it is rendered on a different machine? -Peter P.S. I've been working on a pic replacement based on cl-pdf that I've been using to generate figures for my book. The code is still pretty grotty but here are some figures I've generated. *I* think they're pretty; better than the ASCII art I was using before anyway. I'll eventually polish up the code and release it. In fact I may use it as an example in my book. -- Peter Seibel peter at javamonkey.com Lisp is the red pill. -- John Fraser, comp.lang.lisp From marc.battyani at fractalconcept.com Thu Dec 18 20:49:45 2003 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Thu, 18 Dec 2003 21:49:45 +0100 Subject: [cl-typesetting-devel] Re: [cl-typesetting-announce] cl-typesetting at work! References: <01ce01c3c4f0$37529520$0303a8c0@marc2><20031218162850.GB9571@w-m-p.com> <012901c3c59a$3edecc50$0303a8c0@marc2> Message-ID: <023d01c3c5a8$794af900$0303a8c0@marc2> "Klaus Weidner" wrote > > On Wed, Dec 17, 2003 at 11:50:48PM +0100, Marc Battyani wrote: > > David J Cooper Jr used cl-typesetting and cl-pdf to typeset a nice GDL > > pamphlet. > > > > Here it is: > > http://www.genworks.com/downloads/gdl-pamphlet-portrait.pdf > > That is very impressive. Was this all done in hand-edited Lisp code or > did he use a front end to do it? No front end, pure Lisp code. > One thing I noticed is that xpdf 2.03 has trouble with the fonts, which > apparently have a modified width, resulting in characters being printed > on top of one another. Since acroread 5 displays it fine, this is likely > to be a bug in xpdf. The condensed mode has been added by David. It uses the cl-pdf pdf:set-text-x-scale function. Xpdf probably relies on the X font renderer to display glyphs and may not have the possibility to change their x/y ratio. Marc From marc.battyani at fractalconcept.com Thu Dec 18 21:07:09 2003 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Thu, 18 Dec 2003 22:07:09 +0100 Subject: [cl-typesetting-devel] Re: [cl-typesetting-announce] cl-typesetting at work! References: <01ce01c3c4f0$37529520$0303a8c0@marc2><20031218162850.GB9571@w-m-p.com> Message-ID: <024d01c3c5aa$e976b910$0303a8c0@marc2> "Peter Seibel" wrote > Hmmm. I noticed that to so I printed it, hoping that would clear > things up. No dice. Of course I have no idea how printing really > works; I'm using CUPS on a GNU/Linux box printing to a hp LaserJet > 2200d--for all I know the same code is being used to convert from PDF > to Postscript as xpdf uses to render. Marc, can you give a 30 second > overview of how fonts work in cl-pdf, cl-typesetting, or PDF > generally? For instance, is all the font data embedded in a PDF > document? If so where does it come from? If not, how are the fonts > supposed to be found when it is rendered on a different machine? There are 14 predifined fonts in the pdf format (corresponding to the AFM files in the AFM directory). Every pdf renderer must be able to render them. The other fonts must be embedded. I added support for T1 fonts and Suresh Madhu sent me code for T3 fonts (not yet integrated) The font metrics (the AFM files) define all the dimensional characteristics of the fonts. But not the strokes/data for rendering them. The rendering data can be in the form of T1, T3 and TrueType font data. There are also encodings for mapping char-codes to the glyphs. > P.S. I've been working on a pic replacement based on cl-pdf that I've > been using to generate figures for my book. The code is still pretty > grotty but here are some figures I've generated. > > Very nice! How about full graphs like graphwiz ? (maybe you should box the specials with another box style) > *I* think they're pretty; better than the ASCII art I was using before > anyway. I'll eventually polish up the code and release it. In fact I > may use it as an example in my book. Great! Marc From peter at javamonkey.com Thu Dec 18 21:30:31 2003 From: peter at javamonkey.com (Peter Seibel) Date: Thu, 18 Dec 2003 21:30:31 -0000 Subject: [cl-typesetting-devel] Re: [cl-typesetting-announce] cl-typesetting at work! In-Reply-To: <024d01c3c5aa$e976b910$0303a8c0@marc2> References: <01ce01c3c4f0$37529520$0303a8c0@marc2> <20031218162850.GB9571@w-m-p.com> <024d01c3c5aa$e976b910$0303a8c0@marc2> Message-ID: "Marc Battyani" writes: > There are 14 predifined fonts in the pdf format (corresponding to the AFM > files in the AFM directory). Every pdf renderer must be able to render them. > The other fonts must be embedded. I added support for T1 fonts and Suresh > Madhu sent me code for T3 fonts (not yet integrated) > The font metrics (the AFM files) define all the dimensional characteristics > of the fonts. But not the strokes/data for rendering them. The rendering > data can be in the form of T1, T3 and TrueType font data. > There are also encodings for mapping char-codes to the glyphs. So T1 and T3 refer to Type 1 and Type 3, right? What happened to Type 2? And does any of this explain why the text in the GDL brochure got messed up? > Very nice! How about full graphs like graphwiz ? Well, that's a harder problem since the tricky bit that graphviz does for you is figuring out how to position the nodes so as to minimize line crossings. And they draw nice spline curves which I know nothing about. Right now I'm doing all the layout by hand (except that I can make composite objects, a la--but better than--pic.) But maybe someday I'll take a look at the graphviz code and port it to Lisp. Then the actual drawing bit should be easy. > (maybe you should box the specials with another box style) Hmmm. I'll play around with it. Thanks. -Peter -- Peter Seibel peter at javamonkey.com Lisp is the red pill. -- John Fraser, comp.lang.lisp From kw at w-m-p.com Thu Dec 18 22:00:07 2003 From: kw at w-m-p.com (Klaus Weidner) Date: Thu, 18 Dec 2003 16:00:07 -0600 Subject: [cl-typesetting-devel] cl-typesetting at work! In-Reply-To: References: <01ce01c3c4f0$37529520$0303a8c0@marc2> <20031218162850.GB9571@w-m-p.com> Message-ID: <20031218220007.GA11949@w-m-p.com> On Thu, Dec 18, 2003 at 10:13:06AM -0800, Peter Seibel wrote: > Hmmm. I noticed that to so I printed it, hoping that would clear > things up. No dice. Of course I have no idea how printing really > works; I'm using CUPS on a GNU/Linux box printing to a hp LaserJet > 2200d--for all I know the same code is being used to convert from PDF > to Postscript as xpdf uses to render. Marc, can you give a 30 second > overview of how fonts work in cl-pdf, cl-typesetting, or PDF > generally? For instance, is all the font data embedded in a PDF > document? If so where does it come from? If not, how are the fonts > supposed to be found when it is rendered on a different machine? As Marc explained in his message, it's caused by the condensed printing being done using a rescaling of the existing fonts, using a PDF geometric transformation when drawing the strings. I'm not sure how CUPS prints on your system - on my Debian box, I have "pdftops" which uses the xpdf code, and "pdf2ps" which uses GhostScript. Ghostscript and acroread handle the condensed font correctly, xpdf doesn't. So depending on which one of those CUPS uses, you'll get different results. -Klaus From marc.battyani at fractalconcept.com Fri Dec 19 23:01:57 2003 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Sat, 20 Dec 2003 00:01:57 +0100 Subject: [cl-typesetting-devel] The cl-typesetting repository is online References: <01ce01c3c4f0$37529520$0303a8c0@marc2><20031218162850.GB9571@w-m-p.com> <024d01c3c5aa$e976b910$0303a8c0@marc2> Message-ID: <058201c3c684$1bbe87c0$0303a8c0@marc2> The cl-typesetting repository is online! :) Here it is: http://www.fractalconcept.com:8000/svn/public/cl-typesetting/ It's a subversion repository. You can explore it with any browser but you need to get subversion (subversion.tigris.org) to do a checkout. I'm trying to setup a viewcvs for a more user friendly interface but it does not work so far as I get an error traceback instead of a repository view... If you reply to this mail, please reply only to the devel mailing list. Marc From david.cooper at genworks.com Sat Dec 20 00:13:38 2003 From: david.cooper at genworks.com (David J Cooper Jr) Date: Fri, 19 Dec 2003 19:13:38 -0500 Subject: [cl-typesetting-devel] multi-page documents Message-ID: <16355.37938.71979.988062@mccarthy.genworks.com> Hello, I am thinking about how to tackle multi-page documents with cl-typesetting but am a bit stuck as to how to get started. Each page needs to end up inside a (pdf:with-page ... ) right? So if we have a piece of content (made with typeset::compile-text), we need an intermediate step which figures out how to break that content into multiple pages, right? Or do we need a higher-level thing like "compile-document" which transforms into several "compile-text" forms? Anyway sorry if I'm thrashing a bit here but I just thought I would solicit a bit of discussion before diving in and tackling it. Right now I am looking at a 7-page MS Word document to which I have to make some edits and am supposed to get to a customer by Monday, and if possible I would love to convert the whole thing into cl-typesetting and deliver a nice PDF on Monday ... ;) Thanks, -dave From marc.battyani at fractalconcept.com Sat Dec 20 11:23:35 2003 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Sat, 20 Dec 2003 12:23:35 +0100 Subject: [cl-typesetting-devel] Re: did my note to cl-typesetting-devel get through? References: <16355.51399.576099.65416@mccarthy.genworks.com> Message-ID: <06ee01c3c6eb$b8e3b1d0$0303a8c0@marc2> Hi Dave, > I sent this note to cl-typesetting-devel a few hours ago. I did not > receive either it or a bounce. Did it come through to you? No. I've also sent messages to announce the subversion repositories in the 4 lists and seen nothing. I've sent an email to common-lisp.net. > I am thinking about how to tackle multi-page documents with > cl-typesetting but am a bit stuck as to how to get started. > > Each page needs to end up inside a > > (pdf:with-page ... ) > > right? Yes. > So if we have a piece of content (made with typeset::compile-text), > we need an intermediate step which figures out how to break that > content into multiple pages, right? Yes, it's done automatically, you just continue to use the text-content object while it's not empty. > Or do we need a higher-level thing like "compile-document" which > transforms into several "compile-text" forms? No. > Anyway sorry if I'm thrashing a bit here but I just thought I would > solicit a bit of discussion before diving in and tackling it. The devel mailing list is for this...when it works :( > Right now I am looking at a 7-page MS Word document to which I have > to make some edits and am supposed to get to a customer by Monday, > and if possible I would love to convert the whole thing into > cl-typesetting and deliver a nice PDF on Monday ... ;) Sure! Is it a complex one or just text ? Marc From kw at w-m-p.com Sat Dec 20 15:59:03 2003 From: kw at w-m-p.com (Klaus Weidner) Date: Sat, 20 Dec 2003 09:59:03 -0600 Subject: [cl-typesetting-devel] multi-page documents In-Reply-To: <16355.37938.71979.988062@mccarthy.genworks.com> References: <16355.37938.71979.988062@mccarthy.genworks.com> Message-ID: <20031220155903.GA16626@w-m-p.com> On Fri, Dec 19, 2003 at 07:13:38PM -0500, David J Cooper Jr wrote: > I am thinking about how to tackle multi-page documents with > cl-typesetting but am a bit stuck as to how to get started. > > Each page needs to end up inside a > > (pdf:with-page ... ) > > right? > > So if we have a piece of content (made with typeset::compile-text), > we need an intermediate step which figures out how to break that > content into multiple pages, right? Just accumulate the content using compile-text, and then let the engine split it into pages for you. Try something like this: (defun draw-page (content) (let ((x 72) (y 720) (dx 468) (dy 648)) (pdf:with-page () (pdf:with-saved-state (pdf:translate x y) (let ((box (make-filled-vbox content dx dy))) (when box (stroke box 0 0))))))) ;; ... (let ((content (compile-text () (paragraph "cl-typesetting" :eol (vspace 2) (with-style (:font "Times-Italic" :font-size 13) "The cool Common Lisp typesetting system")) ;; ... ))) (pdf:with-document () (while (boxes content) (draw-page content)))) (pdf:write-document file))) From david.cooper at genworks.com Sat Dec 20 16:38:53 2003 From: david.cooper at genworks.com (David J Cooper Jr) Date: Sat, 20 Dec 2003 11:38:53 -0500 Subject: [cl-typesetting-devel] multi-page documents In-Reply-To: <20031220155903.GA16626@w-m-p.com> References: <16355.37938.71979.988062@mccarthy.genworks.com> <20031220155903.GA16626@w-m-p.com> Message-ID: <16356.31517.398246.989451@mccarthy.genworks.com> Ok I will check it out. Somehow I didn't realize the page-breaking stuff was already in there. Now some of the things on Marc's to-do list (like the need to add multi-page support for tables), make more sense. The sample document I am working with has bullet lists. I have a really clunky implementation of bullet lists now, using tables with no borders, but Marc has said this is overkill and bullet (and number) lists would be better done simply with first-line-indent and left-margin, which presumably will already work with the page breaking. So maybe everything I need is already in there. But i will report back any potentially useful additions I end up with (like friendlier syntax for bullet lists, multiple pages, etc). P.S. I am using cl-interpol for adding special characters like bullets, which seems to be working out well. Klaus Weidner writes: > On Fri, Dec 19, 2003 at 07:13:38PM -0500, David J Cooper Jr wrote: > > I am thinking about how to tackle multi-page documents with > > cl-typesetting but am a bit stuck as to how to get started. > > > > Each page needs to end up inside a > > > > (pdf:with-page ... ) > > > > right? > > > > So if we have a piece of content (made with typeset::compile-text), > > we need an intermediate step which figures out how to break that > > content into multiple pages, right? > > Just accumulate the content using compile-text, and then let the engine > split it into pages for you. > > Try something like this: > > (defun draw-page (content) > (let ((x 72) > (y 720) > (dx 468) > (dy 648)) > (pdf:with-page () > (pdf:with-saved-state > (pdf:translate x y) > (let ((box (make-filled-vbox content dx dy))) > (when box > (stroke box 0 0))))))) > > ;; ... > > (let ((content > (compile-text > () > (paragraph > "cl-typesetting" :eol > (vspace 2) > (with-style (:font "Times-Italic" :font-size 13) > "The cool Common Lisp typesetting system")) > ;; ... > ))) > > (pdf:with-document () > (while (boxes content) > (draw-page content)))) > (pdf:write-document file))) > > From tarvydas at allstream.net Sun Dec 21 16:53:58 2003 From: tarvydas at allstream.net (tarvydas) Date: Sun, 21 Dec 2003 11:53:58 -0500 Subject: [cl-typesetting-devel] fonts for example Message-ID: <200312211153.58326.tarvydas@allstream.net> I've managed to compile cl-pdf and cl-typesetting (under LWL4.3) and can run "hello". The larger example, "ex", does not run claiming that the fonts CMTI10 and CMEX10 don't exist. I can see that they exist in the "files-for-example" directory. What should I do to get cl-pdf to "find" these fonts? thanks Paul Tarvydas tarvydas at allstream.net From kw at w-m-p.com Sun Dec 21 17:10:31 2003 From: kw at w-m-p.com (Klaus Weidner) Date: Sun, 21 Dec 2003 11:10:31 -0600 Subject: [cl-typesetting-devel] fonts for example In-Reply-To: <200312211153.58326.tarvydas@allstream.net> References: <200312211153.58326.tarvydas@allstream.net> Message-ID: <20031221171031.GA20643@w-m-p.com> On Sun, Dec 21, 2003 at 11:53:58AM -0500, tarvydas wrote: > The larger example, "ex", does not run claiming that the fonts CMTI10 and > CMEX10 don't exist. I can see that they exist in the "files-for-example" > directory. > > What should I do to get cl-pdf to "find" these fonts? You need to copy the contents of files-for-example/ to /tmp/. This reminds me - there should be a nicer way to handle inclusions, i.e. an include path, and the system should also be able to pick up files in locations relative to the "document". That brings up the more general question on a higher-level document API, for which suggestions would be appreciated. -Klaus From marc.battyani at fractalconcept.com Sun Dec 21 21:42:28 2003 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Sun, 21 Dec 2003 22:42:28 +0100 Subject: [cl-typesetting-devel] fonts for example References: <200312211153.58326.tarvydas@allstream.net> Message-ID: <014301c3c80b$68654a90$0303a8c0@marc2> From: "tarvydas" > I've managed to compile cl-pdf and cl-typesetting (under LWL4.3) and can run > "hello". > > The larger example, "ex", does not run claiming that the fonts CMTI10 and > CMEX10 don't exist. I can see that they exist in the "files-for-example" > directory. > > What should I do to get cl-pdf to "find" these fonts? You have to load them with (pdf:load-t1-font ) All the fonts, excepted the 14 predefined ones, must be loaded before you use them. BTW I think I will make the pfb filename optional and derive it from the afm filename. Marc From marc.battyani at fractalconcept.com Sun Dec 21 22:04:49 2003 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Sun, 21 Dec 2003 23:04:49 +0100 Subject: [cl-typesetting-devel] fonts for example References: <200312211153.58326.tarvydas@allstream.net> <20031221171031.GA20643@w-m-p.com> Message-ID: <01af01c3c80e$88f6d140$0303a8c0@marc2> "Klaus Weidner" wrote: > On Sun, Dec 21, 2003 at 11:53:58AM -0500, tarvydas wrote: > > The larger example, "ex", does not run claiming that the fonts CMTI10 and > > CMEX10 don't exist. I can see that they exist in the "files-for-example" > > directory. > > > > What should I do to get cl-pdf to "find" these fonts? > > You need to copy the contents of files-for-example/ to /tmp/. I don't think this will work. you have to explicitely load them with pdf:load-t1-font > This reminds me - there should be a nicer way to handle inclusions, i.e. > an include path, and the system should also be able to pick up files in > locations relative to the "document". That brings up the more general > question on a higher-level document API, for which suggestions would be > appreciated. Sure, but I don't think that fonts paths need to be specified in a document description. Only font names. A better way would be to have a list of paths to search them. Maybe a first pass to enumerate all the fonts in the system and then a "load on demand" mechanism. Marc From peter at javamonkey.com Mon Dec 22 00:37:03 2003 From: peter at javamonkey.com (Peter Seibel) Date: Mon, 22 Dec 2003 00:37:03 -0000 Subject: [cl-typesetting-devel] fonts for example In-Reply-To: <014301c3c80b$68654a90$0303a8c0@marc2> References: <200312211153.58326.tarvydas@allstream.net> <014301c3c80b$68654a90$0303a8c0@marc2> Message-ID: "Marc Battyani" writes: > From: "tarvydas" > > > I've managed to compile cl-pdf and cl-typesetting (under LWL4.3) and can > run > > "hello". > > > > The larger example, "ex", does not run claiming that the fonts CMTI10 and > > CMEX10 don't exist. I can see that they exist in the "files-for-example" > > directory. > > > > What should I do to get cl-pdf to "find" these fonts? > > You have to load them with (pdf:load-t1-font ) > All the fonts, excepted the 14 predefined ones, must be loaded > before you use them. So, just to make sure I understand: PDF defines 14 "standard" fonts that can be used by name (?) in any PDF document. (Presumably any PDF renderer has to know about these fonts.) Beyond that arbitrary fonts can be embedded into a PDF document? And in cl-pdf doing a pdf:load-t1-font does whatever magic is required to get the loaded font to be embedded into the resulting document? > BTW I think I will make the pfb filename optional and derive it from > the afm filename. What does "pfb" stand for? -Peter -- Peter Seibel peter at javamonkey.com Lisp is the red pill. -- John Fraser, comp.lang.lisp From marc.battyani at fractalconcept.com Mon Dec 22 10:47:32 2003 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Mon, 22 Dec 2003 11:47:32 +0100 Subject: [cl-typesetting-devel] fonts for example References: <200312211153.58326.tarvydas@allstream.net><014301c3c80b$68654a90$0303a8c0@marc2> Message-ID: <033501c3c879$1582fd90$0303a8c0@marc2> "Peter Seibel" writes: > "Marc Battyani" writes: > > > You have to load them with (pdf:load-t1-font ) > > All the fonts, excepted the 14 predefined ones, must be loaded > > before you use them. > > So, just to make sure I understand: PDF defines 14 "standard" fonts > that can be used by name (?) in any PDF document. (Presumably any PDF > renderer has to know about these fonts.) Beyond that arbitrary fonts > can be embedded into a PDF document? And in cl-pdf doing a > pdf:load-t1-font does whatever magic is required to get the loaded > font to be embedded into the resulting document? Yes, yes and yes. Though there are also TrueType and T3 fonts. T3 fonts are in alpha stage (thanks to Madhu) > > BTW I think I will make the pfb filename optional and derive it from > > the afm filename. > > What does "pfb" stand for? Printer Font Binary (IIRC) Marc