From ff7675c6083e54a5d97807676041f087a646f144 Mon Sep 17 00:00:00 2001 From: kramm Date: Sun, 7 Nov 2004 17:22:43 +0000 Subject: [PATCH] Applied Moriyoshi Koizumi's CID Type 2 patch. --- pdf2swf/SWFOutputDev.cc | 48 ++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index 75d19e6..37110fd 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -846,7 +846,7 @@ void SWFOutputDev::drawChar(GfxState *state, double x, double y, // check for invisible text -- this is used by Acrobat Capture if ((state->getRender() & 3) == 3) return; - + Gushort *CIDToGIDMap = 0; GfxFont*font = state->getFont(); if(font->getType() == fontType3) { @@ -859,20 +859,29 @@ void SWFOutputDev::drawChar(GfxState *state, double x, double y, state->transform(x, y, &x1, &y1); Unicode u=0; - if(_u && uLen) + char*name=0; + + if(_u && uLen) { u = *_u; + if (u) { + int t; + /* find out char name from unicode index + TODO: should be precomputed + */ + for(t=0;tisCIDFont() && u) { + if(font->isCIDFont()) { GfxCIDFont*cfont = (GfxCIDFont*)font; - int t; - for(t=0;tgetType() == fontCIDType2) { + CIDToGIDMap = cfont->getCIDToGID(); } } else { Gfx8BitFont*font8; @@ -881,13 +890,14 @@ void SWFOutputDev::drawChar(GfxState *state, double x, double y, if(enc && enc[c]) name = enc[c]; } - - msg(" drawChar(%f,%f,c='%c' (%d),u=%d <%d>) CID=%d name=\"%s\"\n",x,y,(c&127)>=32?c:'?',c,u, uLen, font->isCIDFont(), FIXNULL(name)); - - /*x1 = (int)(x1+0.5); - y1 = (int)(y1+0.5);*/ - - int ret = swfoutput_drawchar(&output, x1, y1, name, c, u); + + if (CIDToGIDMap) { + msg(" drawChar(%f, %f, c='%c' (%d), GID=%d, u=%d <%d>) CID=%d name=\"%s\"\n", x, y, (c&127)>=32?c:'?', c, CIDToGIDMap[c], u, uLen, font->isCIDFont(), FIXNULL(name)); + swfoutput_drawchar(&output, x1, y1, name, CIDToGIDMap[c], u); + } else { + msg(" drawChar(%f,%f,c='%c' (%d), u=%d <%d>) CID=%d name=\"%s\"\n",x,y,(c&127)>=32?c:'?',c,u, uLen, font->isCIDFont(), FIXNULL(name)); + swfoutput_drawchar(&output, x1, y1, name, c, u); + } } void SWFOutputDev::endString(GfxState *state) { -- 1.7.10.4