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

Re: Including External Postscript fonts into IDL



Mila Mitra wrote:
> 
> I would like to annotate plots, images , etc. with fonts that
> are available as Postscript outside IDL, in particular
> foreign language fonts (ex. Arabic).
>  Any suggestions on how to get External postscript fonts or other
>  methods to get in external fonts in to IDL (to use for 'xyouts', etc)?

Check out the "Pretty Postscript Output" section of
http://www.astro.washington.edu/deutsch/local_IDL.html for some useful
hints.  Also, I'll add below one of the items, a sample program which has
a few examples of a fancily labeled plot.  There's no Arabic, but
some other Greek symbols, Angstrom symbol, etc.  At the Web site above is
a program called charsets.pro, which generates a page which maps character
numbers to actual characters/symbols for a selected font.

Hope this helps,
Eric


; 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/1850.)*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='!3'+string(197b)+'!X'			; only Simplex 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],xstyle=1, $
    xtitle='Wavelength ('+ang+')', $
    ytitle='Flux (10!U-13!N erg cm!U-2!N s!U-1!N '+ang+'!U-1!N)', $
    title='Artificial 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,2000,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,2000,8.2,/data,charsize=2,'!9a!X(1950)=15!Uh!N37!Um!N23!S.!R!Us!N31'+$
    '   !9d!X(1950)=+56'+degsym+'34'+minsym+'15'+secsym+'2'

end






-- 
----------------------------------------------------------------------------
Eric Deutsch                             email: deutsch@astro.washington.edu
Department of Astronomy                                Voice: (206) 616-2788
University of Washington                                 FAX: (206) 685-0403
Box 351580                     WWW: http://www.astro.washington.edu/deutsch/
Seattle, WA  98195-1580                  Physics/Astronomy Bldg., Room B356F