1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

add the 'debug' option

This commit is contained in:
Lu Wang 2012-08-12 14:04:45 +08:00
parent 265a7785bc
commit bc48fdefd8
3 changed files with 15 additions and 2 deletions

View File

@ -389,6 +389,11 @@ long long HTMLRenderer::install_font(GfxFont * font)
return new_fn_id; return new_fn_id;
} }
if(param->debug)
{
std::cerr << "Install font: (" << (font->getID()->num) << ' ' << (font->getID()->gen) << ") -> " << boost::format("f%|1$x|")%new_fn_id << std::endl;
}
if(font->getType() == fontType3) { if(font->getType() == fontType3) {
std::cerr << "Type 3 fonts are unsupported and will be rendered as Image" << std::endl; std::cerr << "Type 3 fonts are unsupported and will be rendered as Image" << std::endl;
export_remote_default_font(new_fn_id); export_remote_default_font(new_fn_id);
@ -589,6 +594,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const std::string & suf
if(maxcode > 0) if(maxcode > 0)
{ {
ofstream map_fout((boost::format("%1%/%2%.encoding") % TMP_DIR % fn).str().c_str()); ofstream map_fout((boost::format("%1%/%2%.encoding") % TMP_DIR % fn).str().c_str());
int cnt = 0;
for(int i = 0; i <= maxcode; ++i) for(int i = 0; i <= maxcode; ++i)
{ {
Unicode * u; Unicode * u;
@ -596,6 +602,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const std::string & suf
// not sure what to do when n > 1 // not sure what to do when n > 1
if(n > 0) if(n > 0)
{ {
++cnt;
map_fout << boost::format("0x%|1$X|") % (code2GID ? code2GID[i] : i); map_fout << boost::format("0x%|1$X|") % (code2GID ? code2GID[i] : i);
for(int j = 0; j < n; ++j) for(int j = 0; j < n; ++j)
map_fout << boost::format(" 0x%|1$X|") % u[j]; map_fout << boost::format(" 0x%|1$X|") % u[j];
@ -603,8 +610,11 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const std::string & suf
} }
} }
fontscript_fout << boost::format("LoadEncodingFile(\"%1%/%2%.encoding\", \"%2%\")") % TMP_DIR % fn << endl; if(cnt > 0)
fontscript_fout << boost::format("Reencode(\"%1%\", 1)") % fn << endl; {
fontscript_fout << boost::format("LoadEncodingFile(\"%1%/%2%.encoding\", \"%2%\")") % TMP_DIR % fn << endl;
fontscript_fout << boost::format("Reencode(\"%1%\", 1)") % fn << endl;
}
} }
ctu->decRefCnt(); ctu->decRefCnt();

View File

@ -21,6 +21,8 @@ struct Param
double h_eps, v_eps; double h_eps, v_eps;
int process_nontext; int process_nontext;
int debug;
}; };

View File

@ -126,6 +126,7 @@ po::variables_map parse_options (int argc, char **argv)
("heps", po::value<double>(&param.h_eps)->default_value(1.0), "max tolerated horizontal offset (in pixels)") ("heps", po::value<double>(&param.h_eps)->default_value(1.0), "max tolerated horizontal offset (in pixels)")
("veps", po::value<double>(&param.v_eps)->default_value(1.0), "max tolerated vertical offset (in pixels)") ("veps", po::value<double>(&param.v_eps)->default_value(1.0), "max tolerated vertical offset (in pixels)")
("process-nontext", po::value<int>(&param.process_nontext)->default_value(1), "process nontext objects") ("process-nontext", po::value<int>(&param.process_nontext)->default_value(1), "process nontext objects")
("debug", po::value<int>(&param.debug)->default_value(0), "output debug information")
; ;
opt_hidden.add_options() opt_hidden.add_options()