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

dump font encoding for debug; do not force using to-unicode for ttf fonts

This commit is contained in:
Lu Wang 2013-05-03 00:51:58 +08:00
parent 7ac858f4b8
commit 3ed7389ad9

View File

@ -148,7 +148,6 @@ string HTMLRenderer::dump_embedded_font (GfxFont * font, long long fn_id)
{
outf.write(buf, len);
}
outf.close();
obj.streamClose();
}
catch(int)
@ -198,7 +197,7 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
/*
* if parm->tounicode is 0, try the provided tounicode map first
*/
info.use_tounicode = (is_truetype_suffix(suffix) || (param.tounicode >= 0));
info.use_tounicode = (param.tounicode >= 0);
bool has_space = false;
const char * used_map = nullptr;
@ -325,6 +324,14 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
{
ofstream map_outf;
if(param.debug)
{
string fn = (char*)str_fmt("%s/f%llx.map", param.tmp_dir.c_str(), info.id);
tmp_files.add(fn);
map_outf.open(fn);
}
unordered_set<int> codeset;
bool name_conflict_warned = false;
@ -396,6 +403,10 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
memset(cur_mapping, -1, 0x10000 * sizeof(*cur_mapping));
memset(width_list, -1, 0x10000 * sizeof(*width_list));
cur_code = -1;
if(param.debug)
{
map_outf.seekp(0);
}
continue;
}
}
@ -428,6 +439,11 @@ void HTMLRenderer::embed_font(const string & filepath, GfxFont * font, FontInfo
info.space_width = cur_width;
}
}
if(param.debug)
{
map_outf << hex << cur_code << ' ' << mapped_code << ' ' << u << endl;
}
}
ffw_set_widths(width_list, max_key + 1, param.stretch_narrow_glyph, param.squeeze_wide_glyph, param.remove_unused_glyph);