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

fix space height

This commit is contained in:
Lu Wang 2012-09-19 12:24:13 +08:00
parent b5f50de2f4
commit d17e340643
4 changed files with 14 additions and 2 deletions

View File

@ -41,7 +41,6 @@ span {
}
._ {
color:transparent;
font-size:1px;
}
::selection{
background: rgba(127,255,255,1);

View File

@ -35,7 +35,15 @@ void HTMLRenderer::export_remote_font(const FontInfo & info, const string & suff
}
}
css_fout << ")format(\"" << fontfileformat << "\");}.f" << info.id << "{font-family:f" << info.id << ";line-height:" << _round(info.ascent - info.descent) << ";}" << endl;
css_fout << ")format(\"" << fontfileformat << "\");}.f" << info.id << "{font-family:f" << info.id << ";line-height:" << _round(info.ascent - info.descent) << ";}";
// when ' ' is not vaild in the font, when we use ' ' in padding
// the browser will use the fallback font, whose metrics could be (very) different, then the layout will be affected
// so set the font-zie to avoid being affected
if(!(info.has_space))
css_fout << ".f" << info.id << ">._{font-size:1px;}";
css_fout << endl;
}
static string general_font_family(GfxFont * font)

View File

@ -171,6 +171,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
*iter = tolower(*iter);
info.use_tounicode = (is_truetype_suffix(suffix) || (param->tounicode > 0));
info.has_space = false;
const char * used_map = nullptr;
@ -321,6 +322,9 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
u = unicode_from_font(i, font);
}
if(u == ' ')
info.has_space = true;
if(codeset.insert(u).second)
{
cur_mapping[k] = u;

View File

@ -110,6 +110,7 @@ public:
long long id;
bool use_tounicode;
double ascent, descent;
bool has_space; // whether space is included in the font
};
// wrapper of the transform matrix double[6]