1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

working...

This commit is contained in:
Lu Wang 2012-08-27 07:26:30 +08:00
parent a65c4924c2
commit 92c929777e
3 changed files with 11 additions and 17 deletions

View File

@ -143,12 +143,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
n = ctu->mapToUnicode(c, &u);
}
if((n == 0) || (n > 1) || (!isLegalUnicode(*u)))
{
return (Unicode)(c + 0xE000);
}
else
return *u;
return check_unicode(u, n, c);
};
if(!font->isCIDFont())

View File

@ -196,17 +196,8 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
++nSpaces;
}
// TODO: don't use ToUnicode Map for nonttf fonts
if((uLen > 0) && (all_of(u, u+uLen, isLegalUnicode)))
{
outputUnicodes(html_fout, u, uLen);
}
else
{
Unicode u = 0xE000 + code;
outputUnicodes(html_fout, &u, 1);
}
Unicode uu = check_unicode(u, uLen, code);
outputUnicodes(html_fout, &uu, 1);
dx += dx1;
dy += dy1;

View File

@ -65,6 +65,14 @@ static inline bool isLegalUnicode(Unicode u)
return true;
}
static inline Unicode check_unicode(Unicode * u, int len, CharCode code)
{
if((len == 0) || (len > 1) || (!isLegalUnicode(*u)))
return (Unicode)(code + 0xE000);
else
return *u;
}
static inline void outputUnicodes(std::ostream & out, const Unicode * u, int uLen)
{
for(int i = 0; i < uLen; ++i)