Viewing contents of file '../idllib/contrib/tappin/graffer/gr_get_txt.pro'
pro Gr_get_txt, text, nset, ilu, msgid, template=template

;+
; GR_GET_TXT
;	Read an individual Text string from a V2.x GRAFFER file.
;
; Arguments:
;	text	struct	in/out	The graffer text string structure
;	nset	int	input	The serial number of the current
;				dataset.
;	ilu	int	input	File unit number to read
;	msgid	long	input	ID of message window (if created).
;
; Keyword:
;	template	input	If set, then we are getting a template
;				not a full text string.
;
; History:
;	Original: 5/11/96; SJT
;	Shorten name: 25/11/96; SJT
;-

inline = ''

while (not eof(ilu)) do begin
    
    readf, ilu, inline
    tag_val = str_sep(inline, ':')
    for itag = 0, n_elements(tag_val) - 2, 2 do begin
        case (tag_val(itag)) of
            
                                ; Recognized tags for Text items
                                ; C - colour
                                ; S - character size
                                ; O - orientation (degrees
                                ;     anticlockwise from the normal
                                ;     L->R orientation.
                                ; A - justification (from 0 (left
                                ;     aligned) to 1 (right aligned))
                                ; F - Font (IDL hershey font number).
                                ; W - line thickness to draw with.
                                ; X,Y - position of anchor (not used
                                ;       in template).
                                ; N - is the above in normalized or
                                ;     data coordinates.
                                ; T - The actual string (not used in
                                ;     template)
                                ; TE, TTE - End
            
            'C': text(nset).colour = gr_int_val(tag_val(itag+1), 1)
            'S': text(nset).size = gr_flt_val(tag_val(itag+1), 1)
            'O': text(nset).orient = gr_flt_val(tag_val(itag+1), 1)
            'A': text(nset).align = gr_flt_val(tag_val(itag+1), 1)
            'F': text(nset).font = gr_int_val(tag_val(itag+1), 1)
            'W': text(nset).thick = gr_int_val(tag_val(itag+1), 1)
            'X': begin
                if (keyword_set(template)) then graff_msg, msgid,  $
                  "Location not used in template." $
                else text(nset).x = gr_flt_val(tag_val(itag+1), 1)
            end
            'Y': begin
                if (keyword_set(template)) then graff_msg, msgid,  $
                  "Location not used in template." $
                else text(nset).y = gr_flt_val(tag_val(itag+1), 1)
            end
            'N': text(nset).norm = gr_byt_val(tag_val(itag+1), 1)
    
            'T': text(nset).text = gr_str_val(inline, 'T')
            
            'TE': begin
                if (keyword_set(template)) then graff_msg, msgid,  $
                  "WARNING template ended with TE tag."
                return
            end
            'TTE': begin
                if (not keyword_set(template)) then graff_msg, msgid,  $
                  "WARNING text ended with TTE tag."
                return
            end
        endcase
    endfor
endwhile

                
end