Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
In article q9h@senator-bedfellow.MIT.EDU, jabarone@ATHENA.MIT.EDU (John A Barone) writes: > Hi, I'm looking for a postscript font, to use with IDL, that has > math symbols, integral sign, partial derivative, etc. I asked > a similar question earlier and received some useful responses > explaining that the postscript symbol font has some math symbols. > Although it has many of the symbols that the Hearshey math font > has, some important ones are missing, in particular a symbol > for partial derivatives. I was wondering if anyone knows Postscript Symbol font character number 182 is a partial derivative symbol. > of a postscript font one could use with IDL that has a more > complete set of math symbols. I'm trying to write a hearshey-to- > postscript converter so that I can print inputed math equations > using postscript fonts, which look much nicer printed out than > equations using the hearshey fonts IMHO. Since the subject of using Postscript fonts comes up periodically, below a short MAIN_PROGRAM which illustrate use of Posctscript hardware fonts (including Angstrom symbol and all). There is also a MAIN_PROGRAM which prints out character sets, so you can see which number corresponds to which character. Please let me know if you have questions or additions to these programs. Also, if anyone is interested in the setps and psclose procedures, I can make them available; they simplify use of Postscript a little... cheers, Eric Eric Deutsch Email: deutsch@astro.washington.edu Department of Astronomy FM-20 Voice: (206) 543-1979 University of Washington FAX: (206) 685-0403 Seattle, WA 98195 Johnson Hall, Room 226 ------------------------------------------------------------ ------------------- psspecxmpl.pro ; This MAIN_PROGRAM is a demo of how to make publication quality output in ; IDL using Postscript fonts. The program can also be run on X displays ; with the Hershey Triplex font, but special characters will not come out ; looking the same (the price you pay for better quality printed output.) ; See also charsets.pro which prints out the characters sets to the printer. ; Send comments or changes to: deutsch@astro.washington.edu (Eric Deutsch) ; ; You can run this program with something like: ; IDL> setps,/landscape ; direct output to landscape Postscript ; IDL> .run psspecxmpl.pro ; run this program to generate spectrum ; IDL> psclose,auto='sol' ; send output to printer queue sol wl=indgen(2000)*4+1000 ; generate wavelength array spec=sin(wl/150.)*3+4+randomu(seed,2000) ; generate a noisy sine wave if (!d.name eq 'PS') then begin ; If Postscript output mode !p.font=0 ; select hardware fonts device,/helv,/isolatin1 ; Helvetica ISOLatin fontset ang=string(197B) ; Angstrom sym char string thk=4 ; thick borders are nice endif else begin ; If screen or other output mode !p.font=-1 ; select Hershey fonts xyouts,0,0,/norm,'!17' ; Set to Triplex Roman font ang='A' ; Just use A for Angstrom thk=1 ; use regular thickness endelse ; Now create the plot. Note that !U is for superscript (Up) and !N is ; for Normal letter sizes. plot,wl,spec,yr=[0,10], $ xtitle='Wavelength ('+ang+')', $ ytitle='Flux (10!U-13!N erg cm!U-2!N s!U-1!N '+ang+'!U-1!N)', $ title='What a Weird Spectrum', $ xcharsize=1.5, ycharsize=1.5, xthick=thk, ythick=thk ; print a legend-style string with some fancy characters. !9 switches to ; the Postscript Symbol font. !X switches back to the initial font. ; string(nnnB) is a way to generate a string containing a character of ; ASCII value nnn (You NEED the 'B'). xyouts,1000,9,/data,'H!9b!X: !9s '+string(179B)+'!X 4.23'+string(215B)+ $ '10!U-13!N '+string(177B)+' 0.54',charsize=2 ; also here's a fancy example of printing world coordinates. !S is save ; a position and !R is to restore to that position. degsym='!9'+string(176B)+'!X' minsym='!9'+string(162B)+'!X' secsym='!S.!R!9'+string(178B)+'!X' xyouts,1000,8.2,/data,charsize=2,'!9a!X(1950)=15!Uh!N37!Um!N 23!S.!R!Us!N31'+$ ' !9d!X(1950)=+56'+degsym+'34'+minsym+'15'+secsym+'2' end ------------------------------------------------------------ ------------------- charsets.pro ; This MAIN_PROGRAM creates a printed Character Set list for a Postscript ; printer. This program requires the 'setps' and 'psclose' programs, ; although it can be modified to just use set_plot,'ps' and then ; appropriate scaling commands (which is what setps does.) ; Send comments or changes to: deutsch@astro.washington.edu (Eric Deutsch) ; ; Simply run with: ; IDL> .run charsets setps,8,10.5,.25,.25 ; Set 8"x10" Portrait plot window !p.font=0 ; harware fonts fontnum=1 ; select a font to print ; below are some examples of 4 interesting fonts. Change or add the ones ; you want to print. if (fontnum eq 1) then begin & device,/helv,/isolatin1 & $ title='Helvetica ISOLatin1' & endif if (fontnum eq 2) then begin & device,/symbol & $ title='Symbol' & endif if (fontnum eq 3) then begin & device,/times,/isolatin1 & $ title='Times Roman ISOLatin1' & endif if (fontnum eq 4) then begin & device,/palatino,/italic,/isolatin1 & $ title='Palatino Italic ISOLatin1' & endif plot,[0,60],[0,60],/nodata,xsty=7,ysty=7,$ position=[0,0,1,1] ; set up coordinates xyouts,30,58,/data,align=.5,title ; print title col=0 row=0 for i=0,255 do begin ; loop over all characters xyouts,col+5,55-row,strn(i)+'= '+string(byte(i)),/data row=row+1 if (row eq 52) then begin col=col+11 row=0 endif endfor psclose ; close Postscript channel end