diff --git a/src/HTMLRenderer/text.cc b/src/HTMLRenderer/text.cc
index 3b45b7b..3f5847d 100644
--- a/src/HTMLRenderer/text.cc
+++ b/src/HTMLRenderer/text.cc
@@ -404,25 +404,30 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
ffw_close();
/*
* 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 != "")
{
- rename(fn.c_str(), tmp_fn.c_str());
- 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)
- {
- ffw_load_font(tmp_fn.c_str());
- ffw_auto_hint();
- ffw_save(fn.c_str());
- }
- else
- {
- rename(tmp_fn.c_str(), 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);
+ }
+
+ // Call internal hinting procedure if specified
+ if((!hinted) && (param->auto_hint))
+ {
+ ffw_load_font(tmp_fn.c_str());
+ ffw_auto_hint();
+ ffw_save(fn.c_str());
+ hinted = true;
+ }
+
+ if(!hinted)
+ {
+ rename(tmp_fn.c_str(), fn.c_str());
}
/*
diff --git a/src/ffw.c b/src/ffw.c
index 07b3376..e52e29e 100644
--- a/src/ffw.c
+++ b/src/ffw.c
@@ -70,6 +70,13 @@ void ffw_init(int debug)
}
original_enc = FindOrMakeEncoding("original");
+
+ {
+ Val v;
+ v.type = v_int;
+ v.u.ival = 1;
+ SetPrefs("DetectDiagonalStems", &v, NULL);
+ }
}
void ffw_fin(void)
diff --git a/test/test.py b/test/test.py
index f646fb1..6ccdf11 100755
--- a/test/test.py
+++ b/test/test.py
@@ -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 --auto-hint=1 --external-hint-tool="ttfautohint" "%s/%s"' % (DIR,f))
ff = f[:-3]
outf.write('%s
' % (ff,ff))
outf.flush();