mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-07-03 00:35:40 +00:00
fixe logic of hinting
This commit is contained in:
parent
01f546efce
commit
a4f100a0af
|
@ -404,25 +404,30 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
||||||
ffw_close();
|
ffw_close();
|
||||||
/*
|
/*
|
||||||
* Step 4
|
* Step 4
|
||||||
* Call external hinting program
|
* Font Hinting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
bool hinted = false;
|
||||||
|
rename(fn.c_str(), tmp_fn.c_str());
|
||||||
|
|
||||||
|
// Call external hinting program if specified
|
||||||
if(param->external_hint_tool != "")
|
if(param->external_hint_tool != "")
|
||||||
{
|
{
|
||||||
rename(fn.c_str(), tmp_fn.c_str());
|
hinted = (system((char*)str_fmt("%s \"%s\" \"%s\"", param->external_hint_tool.c_str(), tmp_fn.c_str(), fn.c_str())) == 0);
|
||||||
if(system((char*)str_fmt("%s \"%s\" \"%s\"", param->external_hint_tool.c_str(), tmp_fn.c_str(), fn.c_str())) != 0)
|
}
|
||||||
{
|
|
||||||
if(param->auto_hint)
|
// Call internal hinting procedure if specified
|
||||||
{
|
if((!hinted) && (param->auto_hint))
|
||||||
ffw_load_font(tmp_fn.c_str());
|
{
|
||||||
ffw_auto_hint();
|
ffw_load_font(tmp_fn.c_str());
|
||||||
ffw_save(fn.c_str());
|
ffw_auto_hint();
|
||||||
}
|
ffw_save(fn.c_str());
|
||||||
else
|
hinted = true;
|
||||||
{
|
}
|
||||||
rename(tmp_fn.c_str(), fn.c_str());
|
|
||||||
}
|
if(!hinted)
|
||||||
}
|
{
|
||||||
|
rename(tmp_fn.c_str(), fn.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -70,6 +70,13 @@ void ffw_init(int debug)
|
||||||
}
|
}
|
||||||
|
|
||||||
original_enc = FindOrMakeEncoding("original");
|
original_enc = FindOrMakeEncoding("original");
|
||||||
|
|
||||||
|
{
|
||||||
|
Val v;
|
||||||
|
v.type = v_int;
|
||||||
|
v.u.ival = 1;
|
||||||
|
SetPrefs("DetectDiagonalStems", &v, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffw_fin(void)
|
void ffw_fin(void)
|
||||||
|
|
|
@ -11,7 +11,7 @@ with open('out.html','w') as outf:
|
||||||
if not f.lower().endswith('.pdf'):
|
if not f.lower().endswith('.pdf'):
|
||||||
continue
|
continue
|
||||||
print f
|
print f
|
||||||
os.system('pdf2htmlEX --dest-dir html --external-hint-tool="ttfautohint" "%s/%s"' % (DIR,f))
|
os.system('pdf2htmlEX --dest-dir html --auto-hint=1 --external-hint-tool="ttfautohint" "%s/%s"' % (DIR,f))
|
||||||
ff = f[:-3]
|
ff = f[:-3]
|
||||||
outf.write('<a href="html/%shtml" target="pdf">%s</a><br/>' % (ff,ff))
|
outf.write('<a href="html/%shtml" target="pdf">%s</a><br/>' % (ff,ff))
|
||||||
outf.flush();
|
outf.flush();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user