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

fixed re-encoding for cid nonttf fonts

This commit is contained in:
Lu Wang 2012-08-28 00:27:12 +08:00
parent f460476c0f
commit f75ee118ea
2 changed files with 4 additions and 11 deletions

View File

@ -130,7 +130,7 @@ class HTMLRenderer : public OutputDev
// manage styles
////////////////////////////////////////////////////
FontInfo install_font(GfxFont * font);
void install_embedded_font(GfxFont * font, const std::string & suffix, long long fn_id);
void install_embedded_font(GfxFont * font, const std::string & suffix, long long fn_id, bool & use_tounicode);
void install_base_font(GfxFont * font, GfxFontLoc * font_loc, long long fn_id);
void install_external_font (GfxFont * font, long long fn_id);

View File

@ -66,11 +66,7 @@ FontInfo HTMLRenderer::install_font(GfxFont * font)
string suffix = dump_embedded_font(font, new_fn_id);
if(suffix != "")
{
if(!((suffix == ".ttf") || (param->always_apply_tounicode)))
{
cur_info_iter->second.use_tounicode = false;
}
install_embedded_font(font, suffix, new_fn_id);
install_embedded_font(font, suffix, new_fn_id, cur_info_iter->second.use_tounicode);
}
else
{
@ -101,7 +97,7 @@ FontInfo HTMLRenderer::install_font(GfxFont * font)
// TODO
// add a new function and move to text.cc
void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix, long long fn_id)
void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix, long long fn_id, bool & use_tounicode)
{
// TODO Should use standard way to handle CID fonts
/*
@ -137,7 +133,6 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
int maxcode = 0;
Gfx8BitFont * font_8bit = nullptr;
GfxCIDFont * font_cid = nullptr;
if(!font->isCIDFont())
{
@ -180,7 +175,6 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
}
else
{
font_cid = dynamic_cast<GfxCIDFont*>(font);
maxcode = 0xffff;
if(suffix == ".ttf")
@ -199,8 +193,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
}
}
bool use_tounicode = ((suffix == ".ttf") || (param->always_apply_tounicode));
use_tounicode = ((suffix == ".ttf") || (font->isCIDFont()) || (param->always_apply_tounicode));
auto ctu = font->getToUnicode();