1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

working on external hint tool

This commit is contained in:
Lu Wang 2012-09-23 22:53:21 +08:00
parent fa818c3c39
commit c393c1b206
2 changed files with 13 additions and 13 deletions

View File

@ -405,19 +405,8 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
ffw_save(fn.c_str());
ffw_close();
/*
* Step 4
* Reload to retrieve accurate ascent/descent <-- TODO: remove this
*/
rename(fn.c_str(), tmp_fn.c_str());
ffw_load_font(tmp_fn.c_str());
ffw_metric(&info.ascent, &info.descent, &info.em_size);
ffw_save(fn.c_str());
ffw_close();
/*
* Step 5 (keeping the scope)
* Step 4
* Call external hinting program
*/
@ -426,6 +415,17 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
rename(fn.c_str(), tmp_fn.c_str());
system((char*)str_fmt("%s %s %s", param->external_hint_tool.c_str(), tmp_fn.c_str(), fn.c_str()));
}
/*
* Step 5
* Reload to retrieve/fix accurate ascent/descent
*/
rename(fn.c_str(), tmp_fn.c_str());
ffw_load_font(tmp_fn.c_str());
ffw_metric(&info.ascent, &info.descent, &info.em_size);
ffw_save(fn.c_str());
ffw_close();
}
void HTMLRenderer::drawString(GfxState * state, GooString * s)

View File

@ -11,7 +11,7 @@ with open('out.html','w') as outf:
if not f.lower().endswith('.pdf'):
continue
print f
os.system('pdf2htmlEX --dest-dir html --external-hint-tool=ttfautohint "%s/%s"' % (DIR,f))
os.system('pdf2htmlEX --dest-dir html --external-hint-tool="ttfautohint" "%s/%s"' % (DIR,f))
ff = f[:-3]
outf.write('<a href="html/%shtml" target="pdf">%s</a><br/>' % (ff,ff))
outf.flush();