now use argv0 to initialize ffw

This commit is contained in:
Stephen Gaito 2019-12-11 10:06:31 +00:00
parent 1e7355f6fc
commit 76c64a3c2a
5 changed files with 9 additions and 7 deletions

View File

@ -75,7 +75,7 @@ namespace pdf2htmlEX {
struct HTMLRenderer : OutputDev
{
HTMLRenderer(Param & param);
HTMLRenderer(const char* progPath, Param & param);
virtual ~HTMLRenderer();
void process(PDFDoc * doc);

View File

@ -41,7 +41,7 @@ using std::abs;
using std::cerr;
using std::endl;
HTMLRenderer::HTMLRenderer(Param & param)
HTMLRenderer::HTMLRenderer(const char* progPath, Param & param)
:OutputDev()
,param(param)
,html_text_page(param, all_manager)
@ -56,7 +56,7 @@ HTMLRenderer::HTMLRenderer(Param & param)
globalParams->setErrQuiet(true);
}
ffw_init(param.debug);
ffw_init(progPath, param.debug);
cur_mapping.resize(0x10000);
cur_mapping2.resize(0x100);

View File

@ -439,7 +439,7 @@ int main(int argc, char **argv)
param.last_page = min<int>(max<int>(param.last_page, param.first_page), doc->getNumPages());
unique_ptr<HTMLRenderer>(new HTMLRenderer(param))->process(doc);
unique_ptr<HTMLRenderer>(argv[0], new HTMLRenderer(param))->process(doc);
finished = true;
}

View File

@ -19,6 +19,7 @@
#include "SignalHandler.h"
#include "ffw.h"
#include "gfile.h"
#include "fontforge-version-extras.h" // needed for FONTFORGE_GIT_VERSION
#include "fontforge-20190801/autowidth.h"
#include "fontforge-20190801/bitmapchar.h"
@ -67,10 +68,11 @@ static void dumb_logwarning(const char * format, ...) { }
static void dumb_post_error(const char * title, const char * error, ...) { }
void ffw_init(int debug)
void ffw_init(const char* progPath, int debug)
{
ffwSetAction("initialize");
FindProgDir(NULL);
char *localProgPath = strdup(progPath);
FindProgDir(localProgPath);
InitSimpleStuff();
if ( default_encoding==NULL )
default_encoding=FindOrMakeEncoding("ISO8859-1");

View File

@ -21,7 +21,7 @@ extern "C" {
////////////////////////
// global
void ffw_init(int debug);
void ffw_init(const char* progPath, int debug);
void ffw_finalize(void);
typedef struct ffw_version_info {