+ if(swffont->glyph2ascii) {
+ int t;
+ int bad = 0;
+ /* check whether the Unicode indices look o.k.
+ If they don't, disable the unicode lookup by setting
+ the encoding to 255 */
+ for(t=0;t<swffont->numchars;t++) {
+ int c = swffont->glyph2ascii[t];
+ if(c && c < 32 && swffont->glyph[t].shape->bitlen > 16) {
+ // the character maps into the unicode control character range
+ // between 0001-001f. Yet it is not empty. Treat the one
+ // mapping as broken, and look how many of those we find.
+ bad ++;
+ }
+ }
+ if(bad>5) {
+ msg("<warning> Font %s has bad unicode mapping", swffont->name);
+ swffont->encoding = 255;
+ }
+ }
+
+ swf_FontSetID(swffont, ++i->currentswfid);
+
+ if(getScreenLogLevel() >= LOGLEVEL_DEBUG) {
+ // print font information
+ msg("<debug> Font %s (%s)",swffont->name, filename);
+ msg("<debug> | ID: %d", swffont->id);
+ msg("<debug> | Version: %d", swffont->version);
+ msg("<debug> | Name: %s", fontid);
+ msg("<debug> | Numchars: %d", swffont->numchars);
+ msg("<debug> | Maxascii: %d", swffont->maxascii);
+ msg("<debug> | Style: %d", swffont->style);
+ msg("<debug> | Encoding: %d", swffont->encoding);
+ for(int iii=0; iii<swffont->numchars;iii++) {
+ msg("<debug> | Glyph %d) name=%s, unicode=%d size=%d bbox=(%.2f,%.2f,%.2f,%.2f)\n", iii, swffont->glyphnames?swffont->glyphnames[iii]:"<nonames>", swffont->glyph2ascii[iii], swffont->glyph[iii].shape->bitlen,
+ swffont->layout->bounds[iii].xmin/20.0,
+ swffont->layout->bounds[iii].ymin/20.0,
+ swffont->layout->bounds[iii].xmax/20.0,
+ swffont->layout->bounds[iii].ymax/20.0
+ );
+ int t;
+ for(t=0;t<swffont->maxascii;t++) {
+ if(swffont->ascii2glyph[t] == iii)
+ msg("<debug> | - maps to %d",t);
+ }
+ }
+ }
+
+ /* set the font name to the ID we use here */
+ if(swffont->name) free(swffont->name);
+ swffont->name = (U8*)strdup(fontid);
+