swfoutput_setfontmatrix(&output, m11, -m21, m12, -m22);
}
-int charcounter = 0;
void SWFOutputDev::drawChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
GfxFont*font = state->getFont();
if(font->getType() == fontType3) {
- /* type 3 chars are passed primarily as graphics */
+ /* type 3 chars are passed as graphics */
return;
}
double x1,y1;
if(_u)
u = *_u;
- msg("<debug> drawChar(%f,%f,%f,%f,c='%c' (%d),u=%d) CID=%d\n",x,y,dx,dy,c,c,u, font->isCIDFont());
+ msg("<debug> drawChar(%f,%f,%f,%f,c='%c' (%d),u=%d <%d>) CID=%d\n",x,y,dx,dy,c,c,u, uLen, font->isCIDFont());
- if(font->isCIDFont()) {
+ /* find out the character name */
+ char*name=0;
+ if(font->isCIDFont() && u) {
GfxCIDFont*cfont = (GfxCIDFont*)font;
- char*name=0;
- if(u) {
- int t;
- for(t=0;t<sizeof(nameToUnicodeTab)/sizeof(nameToUnicodeTab[0]);t++)
- /* todo: should be precomputed */
- if(nameToUnicodeTab[t].u == u) {
- name = nameToUnicodeTab[t].name;
- break;
- }
- }
-
- if(name)
- swfoutput_drawchar(&output, x1, y1, name, c, u);
- else {
- swfoutput_drawchar(&output, x1, y1, 0, c, u);
+ int t;
+ for(t=0;t<sizeof(nameToUnicodeTab)/sizeof(nameToUnicodeTab[0]);t++) {
+ /* todo: should be precomputed */
+ if(nameToUnicodeTab[t].u == u) {
+ name = nameToUnicodeTab[t].name;
+ break;
+ }
}
} else {
Gfx8BitFont*font8;
font8 = (Gfx8BitFont*)font;
char**enc=font8->getEncoding();
-
if(enc && enc[c])
- swfoutput_drawchar(&output, x1, y1, enc[c], c, u);
- else {
- swfoutput_drawchar(&output, x1, y1, 0, c, u);
- }
+ name = enc[c];
}
+
+ int ret = swfoutput_drawchar(&output, x1, y1, name, c, u);
}
void SWFOutputDev::endString(GfxState *state)
/* process a character. */
-static void drawchar(struct swfoutput*obj, SWFFONT *swffont, char*character, int charnr, int u, swfmatrix*m)
+static int drawchar(struct swfoutput*obj, SWFFONT *swffont, char*character, int charnr, int u, swfmatrix*m)
{
int usefonts=1;
if(m->m12!=0 || m->m21!=0)
int charid = getCharID(swffont, charnr, character, u);
if(charid<0) {
- msg("<warning> Didn't find character '%s' (%d) in current charset (%s, %d characters)",
- FIXNULL(character),charnr, FIXNULL((char*)swffont->name), swffont->numchars);
- return;
+ msg("<warning> Didn't find character '%s' (c=%d,u=%d) in current charset (%s, %d characters)",
+ FIXNULL(character),charnr, u, FIXNULL((char*)swffont->name), swffont->numchars);
+ return 0;
}
if(shapeid>=0)
endshape();
putcharacter(obj, swffont->id, charid,(int)(m->m13*20),(int)(m->m23*20),
(int)(m->m11+0.5));
+ return 1;
}
/*else
{
}
/* draws a character at x,y. */
-void swfoutput_drawchar(struct swfoutput* obj,double x,double y,char*character, int charnr, int u)
+int swfoutput_drawchar(struct swfoutput* obj,double x,double y,char*character, int charnr, int u)
{
swfmatrix m;
m.m11 = obj->fontm11;
m.m22 = obj->fontm22;
m.m13 = x;
m.m23 = y;
- drawchar(obj, obj->swffont, character, charnr, u, &m);
+ return drawchar(obj, obj->swffont, character, charnr, u, &m);
}
/* initialize the swf writer */
void swfoutput_setfontmatrix(struct swfoutput*,double,double,double,double);
void swfoutput_setlinewidth(struct swfoutput*, double linewidth);
-void swfoutput_drawchar(struct swfoutput*,double x,double y,char*a, int charnr, int u);
+int swfoutput_drawchar(struct swfoutput*,double x,double y,char*a, int charnr, int u);
void swfoutput_drawpath(struct swfoutput*, SWF_OUTLINE*outline, struct swfmatrix*m);
#define LINE_CAP_BUTT 0
#define LINE_CAP_ROUND 1