diff --git a/TODO b/TODO index ad5c55f..6ca7726 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ +remove intermediate save for asc/des + bug found in baidu(ubuntu...), bug_chn option for tounicode-map diff --git a/src/HTMLRenderer/text.cc b/src/HTMLRenderer/text.cc index de91d8f..f01bb26 100644 --- a/src/HTMLRenderer/text.cc +++ b/src/HTMLRenderer/text.cc @@ -391,15 +391,13 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo // Generate an intermediate ttf font in order to retrieve the metrics // TODO: see if we can get the values without save/load - - /* auto fn = str_fmt("%s/f%llx_.ttf", param->tmp_dir.c_str(), info.id); add_tmp_file((char*)fn); ffw_save((char*)fn); ffw_close(); ffw_load_font((char*)fn); - */ + ffw_metric(&info.ascent, &info.descent, &info.em_size); } { auto fn = str_fmt("%s/f%llx%s", diff --git a/src/ffw.c b/src/ffw.c index f372517..371bee0 100644 --- a/src/ffw.c +++ b/src/ffw.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -252,8 +253,8 @@ void ffw_metric(double * ascent, double * descent, int * em_size) int a = bb.maxy; int d = bb.miny; - sf->descent += sf->ascent; - sf->ascent = 0; + sf->ascent = min((int)round(bb.maxy), em); + sf->descent = em - bb.maxy; info->os2_winascent = a; info->os2_typoascent = a;