1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-05 09:38:40 +00:00

Merge branch 'devv' into exp

This commit is contained in:
Lu Wang 2012-08-23 21:30:43 +02:00
commit 7603f3cb88
2 changed files with 28 additions and 9 deletions

View File

@ -12,6 +12,7 @@
#include <boost/format.hpp>
#include <CharCodeToUnicode.h>
#include <fofi/FoFiTrueType.h>
#include "HTMLRenderer.h"
#include "namespace.h"
@ -130,25 +131,39 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
int code2GID_len = 0;
if(ctu)
{
// TODO: ctu could be CID2Unicode for CID fonts
int maxcode = 0;
if(!font->isCIDFont())
{
maxcode = 0xff;
if(suffix != ".ttf")
if(suffix == ".ttf")
{
maxcode = 0xff;
script_fout << "Reencode(\"original\")" << endl;
int buflen;
char * buf = nullptr;
if((buf = font->readEmbFontFile(xref, &buflen)))
{
FoFiTrueType *fftt = nullptr;
if((fftt = FoFiTrueType::make(buf, buflen)))
{
code2GID = dynamic_cast<Gfx8BitFont*>(font)->getCodeToGIDMap(fftt);
code2GID_len = 256;
delete fftt;
}
gfree(buf);
}
}
else
{
// don't reencode non-ttf 8bit fonts with ToUnicode
maxcode = 0;
script_fout << "Reencode(\"unicode\")" << endl;
}
}
else
{
maxcode = 0xffff;
if(suffix != ".ttf")
{
script_fout << "CIDFlatten()" << endl;
}
else
if(suffix == ".ttf")
{
script_fout << "Reencode(\"original\")" << endl;
@ -158,6 +173,10 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
code2GID = _font->getCIDToGID();
code2GID_len = _font->getCIDToGIDLen();
}
else
{
script_fout << "CIDFlatten()" << endl;
}
}
if(maxcode > 0)

View File

@ -102,7 +102,7 @@ string HTMLRenderer::dump_embedded_font (GfxFont * font, long long fn_id)
}
else if (dict->lookup("FontFile", &obj)->isStream())
{
suffix = ".ttf";
suffix = ".pfa";
}
else
{