+ char buf1[256],buf2[256],buf3[256];
+ char* t1lib_config = mktmpname(buf1);
+ char* fontdatabase = mktmpname(buf2);
+
+ sprintf(buf3, "T1LIB_CONFIG=%s", t1lib_config);
+ putenv(buf3);
+
+ FILE*db = fopen(fontdatabase, "wb");
+ FILE*fi = fopen(t1lib_config, "wb");
+ if(!db || !fi) {
+ if(!db) fprintf(stderr, "Couldn't create temporary file %s\n",fontdatabase);
+ if(!fi) fprintf(stderr, "Couldn't create temporary file %s\n",t1lib_config);
+ exit(1);
+ }
+ t1searchpath[0] = 0;
+#ifdef HAVE_DIRENT_H
+ // pass 1
+ addfontdir(0, FONTDIR, &numfonts, 0);
+ for(t=0;t<fontpathpos;t++) {
+ addfontdir(0, fontpaths[t], &numfonts,0);
+ }
+ fprintf(db, "%d\n", numfonts);
+ // pass 2
+ addfontdir(db, FONTDIR, 0, t1searchpath);
+ for(t=0;t<fontpathpos;t++) {
+ addfontdir(db, fontpaths[t], 0, t1searchpath);
+ }
+#else
+#ifdef WIN32
+#error Win32 version requires dirent.h
+#endif
+/* This is a workaround. The correct way would be to
+ get directory listings working on all systems.
+*/
+ strcpy(t1searchpath, SWFTOOLS_DATADIR);
+ strcat(t1searchpath, "/fonts");
+ fprintf(db, "14\n");
+ fprintf(db, "n021003l.afm\n");
+ fprintf(db, "n021023l.afm\n");
+ fprintf(db, "n021004l.afm\n");
+ fprintf(db, "n021024l.afm\n");
+ fprintf(db, "n019003l.afm\n");
+ fprintf(db, "n019023l.afm\n");
+ fprintf(db, "n019004l.afm\n");
+ fprintf(db, "n019024l.afm\n");
+ fprintf(db, "n022003l.afm\n");
+ fprintf(db, "n022023l.afm\n");
+ fprintf(db, "n022004l.afm\n");
+ fprintf(db, "n022024l.afm\n");
+ fprintf(db, "s050000l.afm\n");
+ fprintf(db, "d050000l.afm\n");
+#endif
+
+ fprintf(fi, "FONTDATABASE=%s\n",fontdatabase);
+#ifndef WIN32
+ fprintf(fi, "ENCODING=%s:.\n", t1searchpath);
+ fprintf(fi, "AFM=%s:.\n", t1searchpath);
+ fprintf(fi, "TYPE1=%s:.\n", t1searchpath);
+#else
+ fprintf(fi, "ENCODING=%s\n", FONTDIR);
+ fprintf(fi, "AFM=%s\n", FONTDIR);
+ fprintf(fi, "TYPE1=%s\n", FONTDIR);
+#endif