Debian Codegraph @

system/idiserv/src/fontsup.c

raw symbols SCIP
1 /*===========================================================================
2 Copyright (C) 1995-2009 European Southern Observatory (ESO)
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public
15 License along with this program; if not, write to the Free
16 Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
17 MA 02139, USA.
18
19 Correspondence concerning ESO-MIDAS should be addressed as follows:
20 Internet e-mail: [email protected]
21 Postal address: European Southern Observatory
22 Data Management Division
23 Karl-Schwarzschild-Strasse 2
24 D 85748 Garching bei Muenchen
25 GERMANY
26
27 .VERSIONS
28
29 090709 last modif
30 ===========================================================================*/
31
32 /*
33 fontsup.c K.Banse ESO-Graching
34
35 execute via fontsup.exe
36
37 */
38
39 # include <stdio.h>
40 # include <idi.h>
41 # include <x11defs.h>
42 # include <proto_os.h>
43
44 Window w, fw;
45 char *gets();
46
47
48 int main(argc,argv)
49 int argc;
50 char *argv[];
51
52 {
53 char *display = ""; /* XWindows unit searched in environment */
54 char strf[160];
55 char **fontpntr, *pp, pattern[4];
56
57 int fcount, i;
58 static int fp;
59
60
61
62
63 /* Connect to X server */
64
65 #ifdef vms
66 mydisp[0] = XOpenDisplay("DECW$DISPLAY");
67 #else
68 mydisp[0] = XOpenDisplay(display);
69 #endif
70
71 if (!mydisp[0])
72 {
73 (void) printf("we got an error in XOpenDisplay!\n");
74 return (-1);
75 }
76
77
78 /* get a list of available fonts */
79
80 (void) strcpy(pattern,"*");
81 fontpntr = XListFonts(mydisp[0],pattern,3000,&fcount);
82 (void) printf("total no. of available fonts for X11 = %d\n",fcount);
83
84 fp = osaopen("x11fonts.dat",1);
85 if (fp == -1)
86 (void) printf("Could not open fontfile x11fonts.dat...\n");
87
88
89 /* loop through Font list */
90
91 for (i=0; i<fcount; i++)
92 {
93 pp = *fontpntr++;
94 sprintf(strf,"(%d): %s",i+1,pp);
95 if (fp != -1)
96 osawrite(fp,strf,(int)strlen(strf));
97 }
98
99 if (fp != -1) (void) osaclose(fp);
100
101 return 0;
102 }