source: trunk/SRC/Textoidl/showtex.pro @ 325

Last change on this file since 325 was 325, checked in by pinsard, 17 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.8 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;-
49PRO showtex, FONT=fnt, HELP=help
50;
51  compile_opt idl2, strictarrsubs
52;
53
54; Return to caller on error.
55    On_error, 2
56
57; Print help if needed.
58    IF keyword_set(help) THEN BEGIN
59        print, '    Display TeX sequence translation table on current graphics device.'
60        print, '    showtex'
61        print, '    Keywords:'
62        print, '       /HELP       print this message and return'
63        print, '       FONT        set to 0 to use hardware fonts for current device,'
64        print, '                   -1 to use vector fonts (DEFAULT)'
65        print, '    NOTES:  - The only hardware font supported is PostScript.'
66        print, '            - The FONT keyword overrides the font selected in !p.font'
67        return
68    ENDIF
69   
70;  We begin by deciding on the font.  PostScript = 0 means use vector.
71    PostScript = 0
72    PlotTitle = 'Vector Fonts'
73    IF n_elements(fnt) EQ 0 THEN BEGIN ; get font from !p.font
74        IF !P.font NE -1 THEN BEGIN ; User wants hardware font.
75            PostScript = 1
76            PlotTitle = 'PostScript Fonts'
77        ENDIF
78    ENDIF ELSE BEGIN            ; get font from FONT keyword
79        IF fnt NE -1 THEN BEGIN
80            PostScript = 1
81            PlotTitle = 'PostScript Fonts'
82        ENDIF
83    ENDELSE
84   
85;  Bomb out if user wants hardware font for non-PostScript device.
86    IF (PostScript EQ 1) AND (strupcase(!D.name) NE 'PS') THEN BEGIN   
87                                              ; Device isn't postscript
88                                              ; and user wants hardware
89                                              ; font.  Not good.
90        print, 'Warning: No translation for device: ', !D.name
91        return
92    ENDIF
93   
94; Set !P.font to value indicated by FONT keyword, saving surrent
95; setting to reset at end.
96    OldPFont = !p.font
97    !p.font = PostScript - 1
98
99    erase
100    seq = textoidl(/tex)
101    DisplayString = seq + '  ' + textoidl(seq)
102
103    nseq = n_elements(seq)
104    nrows = nseq/5 + 1          ; Five sequences per row.
105    dx = .9/5.
106    dy = .9/nrows
107    y=.95
108    xyouts,.5,y,PlotTitle,align=.5,/norm,size=2.5
109    count=0
110    FOR i = 1L, nrows DO BEGIN
111        y= y - dy
112        x = .1
113        FOR j = 1, 5 DO BEGIN
114            IF (count LT nseq ) THEN xyouts, x, y, DisplayString[count], align = .5, /norm
115            count = count+1
116            x = x + dx
117        ENDFOR
118    ENDFOR
119
120; Restore old !P.font.
121    !p.font = OldPFont
122END
Note: See TracBrowser for help on using the repository browser.