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

still need work for cid truetype

This commit is contained in:
Lu Wang 2012-08-21 00:32:03 +02:00
parent abdc2f3da4
commit 45d90ea7d6

View File

@ -8,7 +8,6 @@
*/
#include <iostream>
#include <unordered_map>
#include <boost/format.hpp>
@ -17,8 +16,6 @@
#include "HTMLRenderer.h"
#include "namespace.h"
using std::unordered_map;
long long HTMLRenderer::install_font(GfxFont * font)
{
assert(sizeof(long long) == 2*sizeof(int));
@ -128,8 +125,6 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
script_fout << format("Open(%1%, 1)") % (tmp_dir / (fn + suffix)) << endl;
unordered_map<int,int> gid2cid;
auto ctu = font->getToUnicode();
int * code2GID = nullptr;
if(ctu)
@ -158,14 +153,9 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
GfxCIDFont * _font = dynamic_cast<GfxCIDFont*>(font);
int len;
// code2GID has been stored for embedded CID fonts
code2GID = _font->getCodeToGIDMap(nullptr, &maxcode);
int * p = _font->getCIDToGID();
int l = _font->getCIDToGIDLen();
for(int i = 0; i < l; ++i)
gid2cid.insert(make_pair(p[i], i));
// ??
code2GID = _font->getCodeToGIDMap(nullptr, &len);
}
}
@ -183,7 +173,7 @@ void HTMLRenderer::install_embedded_font(GfxFont * font, const string & suffix,
if(n > 0)
{
++cnt;
map_fout << format("0x%|1$X|") % (code2GID ? code2GID[i] : i);
map_fout << format("0x%|1$X|") % (((!font->hasToUnicodeCMap()) && code2GID) ? code2GID[i] : i);
for(int j = 0; j < n; ++j)
map_fout << format(" 0x%|1$X|") % u[j];
map_fout << format(" # 0x%|1$X|") % i << endl;