function lenstr,str ;+ ; ROUTINE: lenstr ; USEAGE: result=lenstr(str) ; ; input: ; str a single string or string array. ; ; output: ; result length of the string(s) in normalized units ; the number of elements of RESULT matches the number of ; elements of STRING. ; ; procedure: ; This function returns the physical length of the ; string on the output device, not the number of ; characters. This is done by first switching to 'X' ; and writing the string(s) with XYOUTS in graphics ; mode 5, which disables display to the screen but ; does not interfere with operation of XYOUTS. The ; WIDTH keyword parameter of XYOUTS is used to ; retrieve the physical length of the string(s). ; ; author: Paul Ricchiazzi ESRG 7apr93 ;- dsave=!d.name set_plot,'X' device,get_graphics=oldg,set_graphics=5 if keyword_set(charsize) eq 0 then charsize=1 nn=n_elements(str) case nn of 0:w=0 1:xyouts,0,0,/device,str,width=w else:begin w=fltarr(nn) for i=0,nn-1 do begin xyouts,0,0,/device,str(i),width=ww w(i)=ww endfor end endcase device,set_graphics=oldg set_plot,dsave ; if dsave eq 'PS' then w=w*1.25 ; Tek Phaser if dsave eq 'PS' then w=w*1.606529 ; Apple LaserWriter return,w end