mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-07-05 17:48:38 +00:00
fix space height
This commit is contained in:
parent
b5f50de2f4
commit
d17e340643
|
@ -41,7 +41,6 @@ span {
|
||||||
}
|
}
|
||||||
._ {
|
._ {
|
||||||
color:transparent;
|
color:transparent;
|
||||||
font-size:1px;
|
|
||||||
}
|
}
|
||||||
::selection{
|
::selection{
|
||||||
background: rgba(127,255,255,1);
|
background: rgba(127,255,255,1);
|
||||||
|
|
|
@ -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)
|
static string general_font_family(GfxFont * font)
|
||||||
|
|
|
@ -171,6 +171,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
|
||||||
*iter = tolower(*iter);
|
*iter = tolower(*iter);
|
||||||
|
|
||||||
info.use_tounicode = (is_truetype_suffix(suffix) || (param->tounicode > 0));
|
info.use_tounicode = (is_truetype_suffix(suffix) || (param->tounicode > 0));
|
||||||
|
info.has_space = false;
|
||||||
|
|
||||||
const char * used_map = nullptr;
|
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);
|
u = unicode_from_font(i, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(u == ' ')
|
||||||
|
info.has_space = true;
|
||||||
|
|
||||||
if(codeset.insert(u).second)
|
if(codeset.insert(u).second)
|
||||||
{
|
{
|
||||||
cur_mapping[k] = u;
|
cur_mapping[k] = u;
|
||||||
|
|
|
@ -110,6 +110,7 @@ public:
|
||||||
long long id;
|
long long id;
|
||||||
bool use_tounicode;
|
bool use_tounicode;
|
||||||
double ascent, descent;
|
double ascent, descent;
|
||||||
|
bool has_space; // whether space is included in the font
|
||||||
};
|
};
|
||||||
|
|
||||||
// wrapper of the transform matrix double[6]
|
// wrapper of the transform matrix double[6]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user