if (glyphcount) /* this _if_ is not in the specs */
swf_GetU16(tag); // fontcodeoffset
}
+ /* TODO: we should use the offset positions, not just
+ blindly read in shapes */
for (t = 0; t < glyphcount; t++)
swf_GetSimpleShape(tag, &(font->glyph[t].shape));
swf_SetBlock(tag, f->name, strlen(f->name));
} else {
/* font name (="") */
- swf_SetU8(tag, 0); /*placeholder */
+ swf_SetU8(tag, 0);
}
/* number of glyphs */
swf_SetU16(tag, f->numchars);
if(f->glyph[t].shape) {
swf_SetSimpleShape(tag, f->glyph[t].shape);
} else {
- swf_SetU8(tag, 0);
- swf_SetU8(tag, 0);
+ swf_SetU8(tag, 0); //non-edge(1) + edge flags(5)
}
}
}
else
swf_SetRGB(t, color);
}
- if (dx)
+ if (dx) {
+ if(dx>32767 || dx<-32768)
+ fprintf(stderr, "Warning: Horizontal char position overflow: %d\n", dx);
swf_SetS16(t, dx);
- if (dy)
+ }
+ if (dy) {
+ if(dy>32767 || dy<-32768)
+ fprintf(stderr, "Warning: Vertical char position overflow: %d\n", dy);
swf_SetS16(t, dy);
+ }
if (font)
swf_SetU16(t, size);
SWF swf;
if (!filename)
return 0;
- f = open(filename, O_RDONLY);
+ f = open(filename, O_RDONLY|O_BINARY);
if (f < 0 || swf_ReadSWF(f, &swf) < 0) {
fprintf(stderr, "%s is not a valid SWF font file or contains errors.\n", filename);
t = swf_InsertTag(t, ST_END);
- f = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0644);
+ f = open(filename, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0644);
if FAILED
(swf_WriteSWF(f, &swf)) fprintf(stderr, "WriteSWF() failed in writeFont().\n");
close(f);