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

fix asc/des

This commit is contained in:
Lu Wang 2012-09-17 01:14:58 +08:00
parent 8da7238037
commit e2470203ab
4 changed files with 25 additions and 3 deletions

View File

@ -85,7 +85,6 @@ void HTMLRenderer::LineBuffer::flush(void)
<< "\""
<< " class=\"l t" << tm_id
<< " h" << renderer->install_height(max_ascent)
<< "\" data-asc=\"" << max_ascent
<< "\">";
auto cur_state_iter = states.begin();

View File

@ -360,8 +360,8 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
{
// read metrics
// int em = ff_get_em_size();
int ascent = ff_get_max_ascent();
int descent = ff_get_max_descent();
int ascent,descent;
ff_metric(&ascent, &descent);
int em = ascent + descent;
if(em != 0)

View File

@ -207,6 +207,26 @@ void ff_close(void)
cur_fv = NULL;
}
void ff_metric(int * ascent, int * descent)
{
*ascent = cur_fv->sf->ascent;
*descent = cur_fv->sf->descent;
cur_fv->sf->pfminfo.os2_winascent = 0;
cur_fv->sf->pfminfo.os2_typoascent = 0;
cur_fv->sf->pfminfo.hhead_ascent = 0;
cur_fv->sf->pfminfo.winascent_add = 0;
cur_fv->sf->pfminfo.typoascent_add = 0;
cur_fv->sf->pfminfo.hheadascent_add = 0;
cur_fv->sf->pfminfo.os2_windescent = 0;
cur_fv->sf->pfminfo.os2_typodescent = 0;
cur_fv->sf->pfminfo.hhead_descent = 0;
cur_fv->sf->pfminfo.windescent_add = 0;
cur_fv->sf->pfminfo.typodescent_add = 0;
cur_fv->sf->pfminfo.hheaddescent_add = 0;
}
int ff_get_em_size(void)
{
return (cur_fv->sf->pfminfo.os2_typoascent - cur_fv->sf->pfminfo.os2_typodescent);

View File

@ -29,6 +29,9 @@ void ff_reencode_raw2(char ** mapping, int mapping_len, int force);
void ff_cidflatten(void);
void ff_save(const char * filename);
void ff_close(void);
// fix metrics and get them
void ff_metric(int * ascent, int * descent);
int ff_get_em_size(void);
int ff_get_max_ascent(void);
int ff_get_max_descent(void);