- for(t=0;t<=chardatapos;t++)
- {
- if(lastfontid != chardata[t].fontid ||
- lastx!=chardata[t].x ||
- lasty!=chardata[t].y ||
- !colorcompare(&color, &chardata[t].color) ||
- charstorepos==127 ||
- lastsize != chardata[t].size ||
- t == chardatapos)
- {
- if(charstorepos && pass==0)
- {
- int s;
- for(s=0;s<charstorepos;s++)
- {
- while(charids[s]>=(1<<glyphbits))
- glyphbits++;
- while(charadvance[s]>=(1<<advancebits))
- advancebits++;
- }
- }
- if(charstorepos && pass==1)
- {
- tag->bitcount = 0;
- SetBits(tag, 0, 1); // GLYPH Record
- SetBits(tag, charstorepos, 7); // number of glyphs
- int s;
- for(s=0;s<charstorepos;s++)
- {
- SetBits(tag, charids[s], glyphbits);
- SetBits(tag, charadvance[s], advancebits);
- }
- }
- charstorepos = 0;
-
- if(pass == 1 && t<chardatapos)
- {
- RGBA*newcolor=0;
- SWFFONT*newfont=0;
- int newx = 0;
- int newy = 0;
- if(lastx != chardata[t].x ||
- lasty != chardata[t].y)
- {
- newx=chardata[t].x;
- newy=chardata[t].y;
- }
- if(!colorcompare(&color, &chardata[t].color))
- {
- color = chardata[t].color;
- newcolor = &color;
- }
- font.id = chardata[t].fontid;
- if(lastfontid != chardata[t].fontid || lastsize != chardata[t].size)
- newfont = &font;
-
- tag->bitcount = 0;
- TextSetInfoRecord(tag, newfont, chardata[t].size, newcolor, newx,newy);
- }
-
- lastfontid = chardata[t].fontid;
- lastx = chardata[t].x;
- lasty = chardata[t].y;
- lastsize = chardata[t].size;
- }
-
- if(t==chardatapos)
- break;
-
- int advance;
- int nextt = t==chardatapos-1?t:t+1;
- int rel = chardata[nextt].x-chardata[t].x;
- if(rel>=0 && (rel<(1<<(advancebits-1)) || pass==0)) {
- advance = rel;
- lastx=chardata[nextt].x;
- }
- else {
- advance = 0;
- lastx=chardata[t].x;
- }
- charids[charstorepos] = chardata[t].charid;
- charadvance[charstorepos] = advance;
- charstorepos ++;
- }
+ for(t=0;t<=chardatapos;t++)
+ {
+ if(lastfontid != chardata[t].fontid ||
+ lastx!=chardata[t].x ||
+ lasty!=chardata[t].y ||
+ !colorcompare(&color, &chardata[t].color) ||
+ charstorepos==127 ||
+ lastsize != chardata[t].size ||
+ t == chardatapos)
+ {
+ if(charstorepos && pass==0)
+ {
+ int s;
+ for(s=0;s<charstorepos;s++)
+ {
+ while(charids[s]>=(1<<glyphbits))
+ glyphbits++;
+ while(charadvance[s]>=(1<<advancebits))
+ advancebits++;
+ }
+ }
+ if(charstorepos && pass==1)
+ {
+ tag->bitcount = 0;
+ swf_SetBits(tag, 0, 1); // GLYPH Record
+ swf_SetBits(tag, charstorepos, 7); // number of glyphs
+ int s;
+ for(s=0;s<charstorepos;s++)
+ {
+ swf_SetBits(tag, charids[s], glyphbits);
+ swf_SetBits(tag, charadvance[s], advancebits);
+ }
+ }
+ charstorepos = 0;
+
+ if(pass == 1 && t<chardatapos)
+ {
+ RGBA*newcolor=0;
+ SWFFONT*newfont=0;
+ int newx = 0;
+ int newy = 0;
+ if(lastx != chardata[t].x ||
+ lasty != chardata[t].y)
+ {
+ newx=chardata[t].x;
+ newy=chardata[t].y;
+ }
+ if(!colorcompare(&color, &chardata[t].color))
+ {
+ color = chardata[t].color;
+ newcolor = &color;
+ }
+ font.id = chardata[t].fontid;
+ if(lastfontid != chardata[t].fontid || lastsize != chardata[t].size)
+ newfont = &font;
+
+ tag->bitcount = 0;
+ swf_TextSetInfoRecord(tag, newfont, chardata[t].size, newcolor, newx,newy);
+ }
+
+ lastfontid = chardata[t].fontid;
+ lastx = chardata[t].x;
+ lasty = chardata[t].y;
+ lastsize = chardata[t].size;
+ }
+
+ if(t==chardatapos)
+ break;
+
+ int advance;
+ int nextt = t==chardatapos-1?t:t+1;
+ int rel = chardata[nextt].x-chardata[t].x;
+ if(rel>=0 && (rel<(1<<(advancebits-1)) || pass==0)) {
+ advance = rel;
+ lastx=chardata[nextt].x;
+ }
+ else {
+ advance = 0;
+ lastx=chardata[t].x;
+ }
+ charids[charstorepos] = chardata[t].charid;
+ charadvance[charstorepos] = advance;
+ charstorepos ++;
+ }