[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xwindow, TVimage and PostScript fonts



Roy E. Hansen (roy.hansen@triad.no) writes:

> I know this post should be sent directly to David Fanning 
> but he answers all the questions on this newsgroup anyhow :-)

I really need to get a life. :-(

I'm making a vow to post only once a week, and
then only if someone really riles me up about color. :-)

Before I go....

> I have been playing around with David Fanning's example programs to 
> see if I can snatch a few ideas for my next project. BTW, Xwindow is a 
> fantastic program.
> 
> One thing that I need is a plot of an image with axis and a colorbar that 
> easily can be printed to high quality PostScript. 
> Easy, I thougth. Use xwindow, tvimage and colorbar as in the following
> example:
> 
> ;------------- Start hurrah.pro -------------------
> 
> PRO hurrah, image, Xxx=xxx, Yyy=yyy
>   
>   erase
>   pos = [0.05, 0.1, 0.8, 0.9]
>   tvimage, image, position=pos
>   !p.position = pos
>   plot, xxx, yyy, /xsty, /ysty, /nodata, /noerase
> 
>   colorbar, position=[0.85, 0.1, 0.95, 0.9], /VERT, /RIGHT
>   
> END  ;------------ hurrah.pro ----------------------
> 
> 
> image = hanning(64) # hanning(64)
> xwindow, 'hurrah', image*200, Xxx=[0,1], Yyy=[0,1], /Out
> 
> END ;-------------- main.pro ----------------------
> 
> This works except one detail: 
> How do I get readable fonts (i.e. PostScript and NOT Hershey fonts) on the PS output?

Well, before I answer this question for you, let me
point out that your ERASE command is already going to
hurt you in PostScript output, since that will force
the output onto the *next* page. You will get a blank
page every time you get output. Think of the trees!

So, I would fix both of these problems by writing
your HURRAH program like this:

 PRO hurrah, image, Xxx=xxx, Yyy=yyy
   
   IF !D.Name EQ 'PS' OR !D.Name EQ 'PRINTER' THEN BEGIN
	font = 0 ; or 1 if you want True-Type fonts
   ENDIF ELSE BEGIN
	erase
       font = -1
   ENDELSE
   pos = [0.05, 0.1, 0.8, 0.9]
   tvimage, image, position=pos
   !p.position = pos
   plot, xxx, yyy, /xsty, /ysty, /nodata, /noerase, FONT=font
 
   colorbar, position=[0.85, 0.1, 0.95, 0.9], /VERT, /RIGHT, FONT=font
   
 END  ;------------ hurrah.pro ----------------------

By the way, I just a moment ago got an e-mail from David Ritscher
(david.ritscher@bigfoot.com) who has sent me a new XWINDOW program
that has implemented a multiple-command-line functionality with
my LinkedList object. I haven't even had a chance to look at it
yet, but we may make it available for people to fool around with.
I've been working on a similar capability (also using that
incredibly useful LINKEDLIST object) in my little free time.

So, if you liked XWINDOW, just hang on a bit. Something better
may be just around the corner. :-)

Cheers,

David
-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155