From 45d90ea7d68cebea0440d6bc5213e50ee820b9c9 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Tue, 21 Aug 2012 00:32:03 +0200 Subject: [PATCH] still need work for cid truetype --- src/HTMLRenderer/install.cc | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/HTMLRenderer/install.cc b/src/HTMLRenderer/install.cc index 739a78c..618f854 100644 --- a/src/HTMLRenderer/install.cc +++ b/src/HTMLRenderer/install.cc @@ -8,7 +8,6 @@ */ #include -#include #include @@ -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 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(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;