+int swf_FontReduce(SWFFONT * f)
+{
+ int i;
+ int max_unicode = 0;
+ int max_glyph = 0;
+ if ((!f) || (!f->use) || f->use->is_reduced)
+ return -1;
+
+ font_freelayout(f);
+ font_freeglyphnames(f);
+
+ f->use->used_glyphs= 0;
+ for (i = 0; i < f->numchars; i++) {
+ if(!f->use->chars[i]) {
+ if(f->glyph2ascii) {
+ f->glyph2ascii[i] = 0;
+ }
+ if(f->glyph[i].shape) {
+ swf_ShapeFree(f->glyph[i].shape);
+ f->glyph[i].shape = 0;
+ f->glyph[i].advance = 0;
+ }
+ f->use->used_glyphs++;
+ } else {
+ max_glyph = i+1;
+ }
+ }
+ for (i = 0; i < f->maxascii; i++) {
+ if(!f->use->chars[f->ascii2glyph[i]]) {
+ if(f->ascii2glyph) {
+ f->ascii2glyph[i] = -1;
+ }
+ } else {
+ max_unicode = i+1;
+ }
+ }
+ f->maxascii = max_unicode;
+ f->numchars = max_glyph;
+ font_freename(f);
+ return 0;
+}
+