source: trunk/TEXT2IDL/showtex.pro @ 7

Last change on this file since 7 was 7, checked in by pinsard, 18 years ago

1st commit according to cerbere.lodyc.jussieu.fr:/usr/home/smasson/IDL_RD/

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1;
2;+
3; NAME:
4;       SHOWTEX
5; PURPOSE:
6;       Display TeX sequence translation table on current graphics device.
7; CATEGORY:
8;       text/strings
9; CALLING SEQUENCE:
10;       showtex
11; INPUTS:
12; KEYWORD PARAMETERS:
13;       /HELP -- print out info on use of the function
14;                and exit.
15;       FONT  -- Set to 0 to use hardware font, -1 to use vector.
16;                Note that the only hardware font supported is
17;                Postscript
18; OUTPUTS:
19; COMMON BLOCKS:
20; SIDE EFFECTS:
21;       Plot is created.
22; NOTES:
23;       Hardware fonts are supported only for device PS (PostScript)
24; EXAMPLE:
25; MODIFICATION HISTORY:
26;       $Id$
27;       $Log: showtex.pro,v $
28;       Revision 1.3  1996/06/14 20:00:27  mcraig
29;       Updated Copyright info.
30;
31;       Revision 1.2  1996/05/09 00:22:17  mcraig
32;       Added error handling and updated built in help.
33;
34;       Revision 1.1  1996/02/08 18:55:12  mcraig
35;       Initial revision
36;
37; RELEASE:
38;       $Name: Rel_1_2 $
39;
40; COPYRIGHT:
41;  Copyright (C) 1996 The Regents of the University of California, All
42;  Rights Reserved.  Written by Matthew W. Craig.
43;  See the file COPYRIGHT for restrictions on distrubting this code.
44;  This code comes with absolutely NO warranty; see DISCLAIMER for details.
45;-
46;
47PRO Showtex, FONT=fnt, HELP=help
48
49; Return to caller on error.
50    On_error, 2
51
52; Print help if needed.
53    IF keyword_set(help) THEN BEGIN
54        print, '    Display TeX sequence translation table on current graphics device.'
55        print, '    showtex'
56        print, '    Keywords:'
57        print, '       /HELP       print this message and return'
58        print, '       FONT        set to 0 to use hardware fonts for current device,'
59        print, '                   -1 to use vector fonts (DEFAULT)'
60        print, '    NOTES:  - The only hardware font supported is PostScript.'
61        print, '            - The FONT keyword overrides the font selected in !p.font'
62        return
63    ENDIF
64   
65;  We begin by deciding on the font.  PostScript = 0 means use vector.
66    PostScript = 0
67    PlotTitle = 'Vector Fonts'
68    IF n_elements(fnt) EQ 0 THEN BEGIN ; get font from !p.font
69        IF !P.font NE -1 THEN BEGIN ; User wants hardware font.
70            PostScript = 1
71            PlotTitle = 'PostScript Fonts'
72        ENDIF
73    ENDIF ELSE BEGIN            ; get font from FONT keyword
74        IF fnt NE -1 THEN BEGIN
75            PostScript = 1
76            PlotTitle = 'PostScript Fonts'
77        ENDIF
78    ENDELSE
79   
80;  Bomb out if user wants hardware font for non-PostScript device.
81    IF (PostScript EQ 1) AND (strupcase(!D.name) NE 'PS') THEN BEGIN   
82                                              ; Device isn't postscript
83                                              ; and user wants hardware
84                                              ; font.  Not good.
85        print, 'Warning: No translation for device: ', !D.name
86        return
87    ENDIF
88   
89; Set !P.font to value indicated by FONT keyword, saving surrent
90; setting to reset at end.
91    OldPFont = !p.font
92    !p.font = PostScript - 1
93
94    erase
95    seq = textoidl(/tex)
96    DisplayString = seq + '  ' + textoidl(seq)
97
98    nseq = n_elements(seq)
99    nrows = nseq/5 + 1          ; Five sequences per row.
100    dx = .9/5.
101    dy = .9/nrows
102    y=.95
103    xyouts,.5,y,PlotTitle,align=.5,/norm,size=2.5
104    count=0
105    FOR i = 1L, nrows DO BEGIN
106        y= y - dy
107        x = .1
108        FOR j = 1, 5 DO BEGIN
109            IF (count LT nseq ) THEN xyouts, x, y, DisplayString(count), align = .5, /norm
110            count = count+1
111            x = x + dx
112        ENDFOR
113    ENDFOR
114
115; Restore old !P.font.
116    !p.font = OldPFont
117END
Note: See TracBrowser for help on using the repository browser.