source: trunk/Textoidl/showtex.pro @ 69

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

upgrade of TEXT2IDL/TEXtoIDL according to cerbere.lodyc.jussieu.fr: /usr/home/smasson/SAXO_RD/ : files

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