From: kramm Date: Fri, 22 Oct 2004 15:08:32 +0000 (+0000) Subject: moved addfontdir to SWFOutputDev.cc. X-Git-Tag: release-0-6-3~272 X-Git-Url: http://git.asbjorn.biz/?a=commitdiff_plain;h=9e6bf03f7912b31c0f30d47c24e8bf3d0dccdfe7;p=swftools.git moved addfontdir to SWFOutputDev.cc. --- 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) {