- pngs=png_create_write_struct(PNG_LIBPNG_VER_STRING,NULL,NULL,NULL);
+ fprintf(out, "%d %d %d %d %d\n", w, h, size, ascent, descent);
+ for(i=0; i<count; ++i)
+ {
+ const GlyphDef *d=defs+i;
+ fprintf(out, "%d %d %d %d %d %d %d %d\n", d->code, d->x, d->y, d->w, d->h, d->offset_x, d->offset_y, d->advance);
+ }
+
+ fclose(out);
+
+ return 0;
+}
+
+int save_png(const char *fn, const char *data, int w, int h, char alpha)
+{
+ FILE *out;
+ png_struct *pngs;
+ png_info *pngi;
+ png_byte *rows[h];
+ int i;
+ png_byte *data2;
+ int color;
+
+ if(!strcmp(fn, "-"))
+ out=stdout;
+ else
+ {
+ out=fopen(fn, "wb");
+ if(!out)
+ {
+ fprintf(stderr, "Couldn't open %s\n",fn);
+ return -1;
+ }
+ }
+
+ pngs=png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);