![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Perl CGl Programming: No experience required.
For example, the following PostScript file will display the alphabet in the Palatino-Italic font: % Check for command line parameters: % Name, FirstSize, Ratio, NumSizes, UseOutline. /FontName where { pop } { /FontName (Palatino-Italic) def } ifelse /FirstSize where { pop } { /FirstSize 15 def } ifelse /Ratio where { pop } { /Ratio 1.6 def } ifelse /NumSizes where { pop } { /NumSizes 3 def } ifelse /UseOutline where { pop } { /UseOutline false def } ifelse /Strings FirstSize 20 gt { [ (ABCDEFGHIJ) (KLMNOPQR) (STUVWXYZ) (abcdefghijklm) (nopqrstuvwxyz) (0123456789<=>) (:;?@ !"#$%&) (\(\)*+,-./[\\]^_) (`{|}~) ] } { [ (ABCDEFGHIJKLMNOPQRSTUVWXYZ) (abcdefghijklmnopqrstuvwxyz) (0123456789<=>:;?@ !"#$%&) (\(\)*+,-./ [\\]^_ `{|}~) ] } ifelse def /sshow { gsave UseOutline { { gsave ( ) dup 0 4 -1 roll put false charpath pathbbox 0 setlinewidth stroke grestore pop 8 add currentpoint exch pop moveto pop } forall } { 2 0 3 -1 roll ashow } ifelse grestore } def FontName findfont FirstSize scalefont setfont clippath pathbbox /top exch def pop pop pop newpath 10 10 moveto NumSizes { gsave nulldevice (Q) false charpath pathbbox grestore exch pop exch sub exch pop 1.25 mul /height exch def Strings { currentpoint exch pop top height 3 mul sub gt { showpage 10 10 height sub moveto } if dup sshow UseOutline not { 0 height rmoveto gsave 0.01 rotate sshow grestore } if 0 height rmoveto } forall Ratio dup scale } repeat showpage Popped into a TIFF-format file, the PostScript code produces the graphical image illustrated in Figure 8.5.
The PostScript code probably looks a little intimidating, but dont worry. The intention here is not to teach you PostScript, but to give you an idea of what it looks like and some of the things you might do with it.
Making a Graphical Access CounterYou can use Perl and Ghostscript to spruce up the Web site access counter you built in Skill 4. Instead of the number of hits on your site being displayed as part of an HTML heading, you can make it graphical. The first thing you need, of course, is Ghostscript. As of this writing, one of the best sources is the University of Wisconsins computer science department Web site. Youll find all of the Ghostscript files beginning at http://www.cs.wisc.edu/~ghost/gsfaq.html. From there, you only need to pick and download the files that are appropriate for your operating system. You UNIX Webmasters get to do the macho UNIX thing and download the Ghostscript C-language source files and compile them. Windows NT and 95 Webmasters have the same option, but you may also download the compiled executable files and simply install them.
Probably the only reason for you to get the C-language source code for Ghostscript on Windows NT and 95 is to include the capability for handling GIF-format graphics files. This is an interesting problem: The Ghostscript you will download from the University of Wisconsins computer science department was developed by Aladdin Enterprises. They dont want any money from you; their license agreement simply states that you will not distribute their software for profit. So much for Aladdin Enterprisesand bless them. The GIF graphical format, which is supported by virtually all Web browsers, is a subject of some controversy, however. CompuServe, the online service, and Unisys, a huge computer company, believe that they own the GIF format, based on some patents that were taken out in the mid-1980s and whose validity has not been completely established. Still, the two companies have enough of a claim on the GIF format to be able to demand payment from developers whose software is written after January 1, 1995 and does files in the GIF format. The folks at Aladdin, wisely erring on the side of avoiding all contact with lawyers, removed the GIF capability from Ghostscript. But their earlier software is still available at the University of Wisconsin Web site and, if you are not afraid of lawsuits, you may want to download the old C source files and compile them.
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. |