X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=pdf2swf%2Fpdf2swf.cc;h=436089283924e1f95b41cb05203d41d8351797ea;hb=55976a64f7acb2654712bbe27aa366ee3d053e5a;hp=c4d331df0222fb1842c45629740edf42d3f41f7e;hpb=9261948c850ed20ed34890b2382e15fb7cc71749;p=swftools.git diff --git a/pdf2swf/pdf2swf.cc b/pdf2swf/pdf2swf.cc index c4d331d..4360892 100644 --- a/pdf2swf/pdf2swf.cc +++ b/pdf2swf/pdf2swf.cc @@ -341,56 +341,6 @@ void args_callback_usage(char*name) printf("-L --preloader=filename Link preloader \"name\" to the pdf (\"%s -L\" for list)\n",name); } -#ifdef HAVE_DIRENT_H -static void addfontdir(char* dirname, int*numfonts) -{ - if(!numfonts) - msg(" Adding %s to search path\n", dirname); - - DIR*dir = opendir(dirname); - if(!dir) { - msg(" Couldn't open directory %s\n", dirname); - return; - } - struct dirent*ent; - while(1) { - ent = readdir (dir); - if (!ent) - break; - int l; - char*name = ent->d_name; - char type = 0; - if(!name) continue; - l=strlen(name); - if(l<4) - continue; - if(!strncasecmp(&name[l-4], ".pfa", 4)) - type=1; - if(!strncasecmp(&name[l-4], ".pfb", 4)) - type=3; - if(!strncasecmp(&name[l-4], ".ttf", 4)) - type=2; - if(type) - { - char*fontname = (char*)malloc(strlen(dirname)+strlen(name)+2); - strcpy(fontname, dirname); -#ifdef WIN32 - strcat(fontname, "\\"); -#else - strcat(fontname, "/"); -#endif - strcat(fontname, name); - if(!numfonts) - msg(" Adding %s to fonts", fontname); - pdfswf_addfont(fontname); - if(numfonts) - (*numfonts)++; - } - } - closedir(dir); -} -#endif - static char* stripfilename(char*filename, char*newext) { char*last1 = strrchr(filename, '/'); @@ -466,20 +416,11 @@ int main(int argn, char *argv[]) exit(0); } -#ifdef HAVE_DIRENT_H - // pass 1 - addfontdir(FONTDIR, &numfonts); + /* add fonts */ + pdfswf_addfontdir(FONTDIR); for(t=0;t Couldn't find any fonts!"); -#endif pdf_doc_t* pdf = pdf_init(filename, password); if(!pdf) {