5 Extension module for the rfxswf library.
6 Part of the swftools package.
8 Copyright (c) 2001 Rainer Böhme <rfxswf@reflex-studio.de>
10 This file is distributed under the GPL, see file COPYING for details
14 #define TF_TEXTCONTROL 0x80
15 #define TF_HASFONT 0x08
16 #define TF_HASCOLOR 0x04
17 #define TF_HASYOFFSET 0x02
18 #define TF_HASXOFFSET 0x01
20 #define FF_WIDECODES 0x01
22 #define FF_ITALIC 0x04
24 #define FF_SHIFTJIS 0x10
25 #define FF_UNICODE 0x20
28 #define FF2_ITALIC 0x02
29 #define FF2_WIDECODES 0x04
30 #define FF2_WIDEOFFSETS 0x08
32 #define FF2_UNICODE 0x20
33 #define FF2_SHIFTJIS 0x40
34 #define FF2_LAYOUT 0x80
36 int swf_FontIsItalic(SWFFONT * f) { return f->style&FONT_STYLE_ITALIC;}
37 int swf_FontIsBold(SWFFONT * f) { return f->style&FONT_STYLE_BOLD;}
39 static const int WRITEFONTID = 0x4e46; // font id for WriteFont and ReadFont
41 int swf_FontEnumerate(SWF * swf,void (*FontCallback) (U16,U8*))
49 { if (swf_GetTagID(t)==ST_DEFINEFONTINFO || swf_GetTagID(t)==ST_DEFINEFONTINFO2 ||
50 swf_GetTagID(t)==ST_DEFINEFONT2)
60 if(swf_GetTagID(t) == ST_DEFINEFONT2)
76 int swf_FontExtract_DefineFont(int id,SWFFONT * f,TAG * t)
93 f->glyph = malloc(sizeof(SWFGLYPH)*n);
94 memset(f->glyph, 0, sizeof(SWFGLYPH)*n);
96 for (i=1;i<n;i++) swf_GetU16(t);
97 for (i=0;i<n;i++) swf_GetSimpleShape(t,&f->glyph[i].shape);
100 swf_RestoreTagPos(t);
104 int swf_FontExtract_DefineFontInfo(int id,SWFFONT * f,TAG * t)
113 { U8 l = swf_GetU8(t);
117 /* Especially with Flash MX, DefineFont2 may have FontInfo fields,
118 too. However, they only add little information to what's already
119 inside the DefineFont2 tag */
124 { if (f->name) free(f->name);
125 f->name = (U8*)malloc(l+1);
127 { swf_GetBlock(t,f->name,l);
131 { swf_RestoreTagPos(t);
135 flags = swf_GetU8(t);
137 f->style |= FONT_STYLE_BOLD;
139 f->style |= FONT_STYLE_ITALIC;
141 f->encoding |= FONT_ENCODING_ANSI;
143 f->encoding |= FONT_ENCODING_SHIFTJIS;
145 f->encoding |= FONT_ENCODING_UNICODE;
147 if(t->id == ST_DEFINEFONTINFO2) {
148 f->language = swf_GetU8(t);
151 f->glyph2ascii = (U16*)malloc(sizeof(U16)*f->numchars);
153 for(i=0; i < f->numchars; i++) {
154 f->glyph2ascii[i] = ((flags&FF_WIDECODES)?swf_GetU16(t):swf_GetU8(t));
155 if(f->glyph2ascii[i] > maxcode)
156 maxcode = f->glyph2ascii[i];
161 f->maxascii = maxcode;
162 f->ascii2glyph = (int*)malloc(sizeof(int)*maxcode);
163 memset(f->ascii2glyph, -1, sizeof(int)*maxcode);
165 for(i = 0; i < f->numchars; i++)
166 f->ascii2glyph[f->glyph2ascii[i]] = i;
169 swf_RestoreTagPos(t);
173 int swf_FontExtract_DefineFont2(int id,SWFFONT * font,TAG * tag)
178 U8 flags1,flags2,namelen;
180 swf_SetTagPos(tag,0);
182 fid = swf_GetU16(tag);
186 flags1 = swf_GetU8(tag);
187 flags2 = swf_GetU8(tag); //reserved flags
190 font->style |= FONT_STYLE_BOLD;
192 font->style |= FONT_STYLE_ITALIC;
194 font->encoding |= FONT_ENCODING_ANSI;
196 font->encoding |= FONT_ENCODING_UNICODE;
198 font->encoding |= FONT_ENCODING_SHIFTJIS;
200 namelen = swf_GetU8(tag);
201 font->name = (U8*)malloc(namelen+1);
202 font->name[namelen]=0;
203 swf_GetBlock(tag, font->name, namelen);
205 glyphcount = swf_GetU16(tag);
206 font->numchars = glyphcount;
208 font->glyph = (SWFGLYPH*)malloc(sizeof(SWFGLYPH)*glyphcount);
209 memset(font->glyph, 0, sizeof(SWFGLYPH)*glyphcount);
210 font->glyph2ascii = (U16*)malloc(sizeof(U16)*glyphcount);
211 memset(font->glyph2ascii, 0, sizeof(U16)*glyphcount);
213 if(flags1&8) { // wide offsets
214 for(t=0;t<glyphcount;t++)
215 swf_GetU32(tag); //offset[t]
217 if(glyphcount) /* this _if_ is not in the specs */
218 swf_GetU32(tag); // fontcodeoffset
220 for(t=0;t<glyphcount;t++)
221 swf_GetU16(tag); //offset[t]
223 if(glyphcount) /* this _if_ is not in the specs */
224 swf_GetU16(tag); // fontcodeoffset
226 for(t=0;t<glyphcount;t++)
227 swf_GetSimpleShape(tag,&(font->glyph[t].shape));
230 for(t=0;t<glyphcount;t++) {
232 if(flags1&4) // wide codes
233 code = swf_GetU16(tag);
235 code = swf_GetU8(tag);
236 font->glyph2ascii[t] = code;
243 font->maxascii = maxcode;
244 font->ascii2glyph = (int*)malloc(sizeof(int)*maxcode);
245 memset(font->ascii2glyph, -1, sizeof(int)*maxcode);
246 for(t=0;t<glyphcount;t++)
248 font->ascii2glyph[font->glyph2ascii[t]] = t;
251 if(flags1&128) { // has layout
253 font->layout = (SWFLAYOUT*)malloc(sizeof(SWFLAYOUT));
254 font->layout->ascent=swf_GetU16(tag);
255 font->layout->descent=swf_GetU16(tag);
256 font->layout->leading=swf_GetU16(tag);
257 for(t=0;t<glyphcount;t++) {
258 S16 advance = swf_GetS16(tag);
259 font->glyph[t].advance = advance;
261 font->layout->bounds = malloc(glyphcount*sizeof(SRECT));
262 for(t=0;t<glyphcount;t++) {
263 swf_ResetReadBits(tag);
264 swf_GetRect(tag, &font->layout->bounds[t]);
267 kerningcount = swf_GetU16(tag);
268 font->layout->kerningcount = kerningcount;
270 font->layout->kerning = (SWFKERNING*)malloc(sizeof(SWFKERNING)*kerningcount);
272 font->layout->kerning =
273 malloc(sizeof(*font->layout->kerning)* kerningcount);
274 for(t=0;t<kerningcount;t++)
276 if(flags1&4) { // wide codes
277 font->layout->kerning[t].char1 = swf_GetU16(tag);
278 font->layout->kerning[t].char2 = swf_GetU16(tag);
280 font->layout->kerning[t].char1 = swf_GetU8(tag);
281 font->layout->kerning[t].char2 = swf_GetU8(tag);
283 font->layout->kerning[t].adjustment = swf_GetS16(tag);
287 swf_RestoreTagPos(t);
292 #define FEDTJ_PRINT 0x01
293 #define FEDTJ_MODIFY 0x02
294 #define FEDTJ_CALLBACK 0x04
296 int swf_FontExtract_DefineTextCallback(int id,SWFFONT * f,TAG * t,int jobs,
297 void(*callback)(int*chars, int nr, int fontid))
301 U8 gbits, abits, flags;
312 gbits = swf_GetU8(t);
313 abits = swf_GetU8(t);
315 flags = swf_GetU8(t);
318 { if (flags&TF_TEXTCONTROL)
319 { if (flags&TF_HASFONT) fid = swf_GetU16(t);
320 if (flags&TF_HASCOLOR)
321 { swf_GetU8(t); // rgb
324 if (swf_GetTagID(t)==ST_DEFINETEXT2) swf_GetU8(t);
326 if (flags&TF_HASXOFFSET) swf_GetS16(t);
327 if (flags&TF_HASYOFFSET) swf_GetS16(t);
328 if (flags&TF_HASFONT) swf_GetU16(t);
333 for (i=0;i<flags;i++)
336 glyph = swf_GetBits(t,gbits);
337 adv = swf_GetBits(t,abits);
338 if (id==fid) // mitlesen ?
339 if (jobs&FEDTJ_PRINT) {
340 { int code = f->glyph2ascii[glyph];
343 if (jobs&FEDTJ_MODIFY)
344 /*if (!f->glyph[code].advance)*/ f->glyph[glyph].advance = adv;
348 if ((id==fid)&&(jobs&FEDTJ_PRINT)) printf("\n");
349 if (jobs&FEDTJ_CALLBACK)
350 callback(buf, flags, fid);
352 flags = swf_GetU8(t);
355 swf_RestoreTagPos(t);
359 int swf_FontExtract_DefineText(int id,SWFFONT * f,TAG * t,int jobs)
361 return swf_FontExtract_DefineTextCallback(id,f,t,jobs,0);
364 int swf_FontExtract(SWF * swf,int id,SWFFONT * * font)
368 if ((!swf)||(!font)) return -1;
370 f = (SWFFONT *)malloc(sizeof(SWFFONT)); font[0] = f;
373 memset(f,0x00,sizeof(SWFFONT));
379 switch (swf_GetTagID(t))
380 { case ST_DEFINEFONT:
381 nid = swf_FontExtract_DefineFont(id,f,t);
385 nid = swf_FontExtract_DefineFont2(id,f,t);
388 case ST_DEFINEFONTINFO:
389 nid = swf_FontExtract_DefineFontInfo(id,f,t);
394 nid = swf_FontExtract_DefineText(id,f,t,f->layout?0:FEDTJ_MODIFY);
403 int swf_FontSetID(SWFFONT * f,U16 id) { if (!f) return -1; f->id = id; return 0; }
405 int swf_FontReduce(SWFFONT * f,FONTUSAGE * use)
407 if ((!f)||(!use)) return -1;
410 for (i=0;i<f->numchars;i++)
411 if (f->glyph[i].shape)
412 { if (f->glyph2ascii[i]<MAX_CHAR_PER_FONT &&
413 use->code[f->glyph2ascii[i]])
414 { f->ascii2glyph[f->glyph2ascii[i]] = j;
415 f->glyph2ascii[j] = f->glyph2ascii[i];
416 f->glyph[j] = f->glyph[i];
420 { swf_ShapeFree(f->glyph[i].shape);
421 f->ascii2glyph[f->glyph2ascii[i]] = -1;
422 f->glyph2ascii[i] = 0;
423 f->glyph[i].shape = NULL;
424 f->glyph[i].advance = 0;
426 } else f->ascii2glyph[f->glyph2ascii[i]] = -1;
433 int swf_FontInitUsage(FONTUSAGE * use)
434 { if (!use) return -1;
435 memset(use->code,0,sizeof(use->code[0])*MAX_CHAR_PER_FONT);
439 int swf_FontUse(FONTUSAGE * use,U8 * s)
440 { if ((!use)||(!s)) return -1;
442 { use->code[s[0]] = 1;
448 int swf_FontSetDefine(TAG * t,SWFFONT * f)
449 { U16*ofs = (U16*)malloc(f->numchars*2);
452 if ((!t)||(!f)) return -1;
453 swf_ResetWriteBits(t);
457 for (i=0;i<f->numchars;i++)
458 if (f->glyph[i].shape)
460 p+=swf_SetSimpleShape(NULL,f->glyph[i].shape);
463 for (i=0;i<j;i++) swf_SetU16(t,ofs[i]+j*2);
465 for (i=0;i<f->numchars;i++)
466 if (f->glyph[i].shape)
467 swf_SetSimpleShape(t,f->glyph[i].shape);
469 swf_ResetWriteBits(t);
474 int swf_FontSetDefine2(TAG *tag, SWFFONT * f)
480 swf_SetU16(tag, f->id);
482 flags |= 128; // haslayout
484 flags |= 4; // widecodes
485 if(f->style & FONT_STYLE_BOLD)
487 if(f->style & FONT_STYLE_ITALIC)
488 flags |= 2; // italic
490 if(f->encoding & FONT_ENCODING_ANSI)
492 if(f->encoding & FONT_ENCODING_UNICODE)
493 flags |= 32; // unicode
494 if(f->encoding & FONT_ENCODING_SHIFTJIS)
495 flags |= 64; // shiftjis
497 swf_SetU8(tag, flags);
498 swf_SetU8(tag, 0); //reserved flags
501 swf_SetU8(tag, strlen(f->name));
502 swf_SetBlock(tag, f->name, strlen(f->name));
504 /* font name (="") */
505 swf_SetU8(tag, 0); /*placeholder*/
507 /* number of glyphs */
508 swf_SetU16(tag, f->numchars);
509 /* font offset table */
511 for(t=0;t<f->numchars;t++)
513 swf_SetU16(tag, /* fontoffset */ 0); /*placeholder*/
516 swf_SetU16(tag, 0); //fontcode-fontoffset
517 for(t=0;t<f->numchars;t++) {
518 tag->data[pos + t*2] = (tag->len-pos);
519 tag->data[pos + t*2 + 1] = (tag->len-pos) >> 8;
520 swf_SetSimpleShape(tag, f->glyph[t].shape);
523 tag->data[pos2] = tag->len - pos;
524 tag->data[pos2 + 1] = (tag->len - pos) >> 8;
526 /* font code table */
527 if(flags & 4) /* wide codes */ {
528 for(t=0;t<f->numchars;t++)
529 swf_SetU16(tag,f->glyph2ascii[t]);
531 for(t=0;t<f->numchars;t++)
532 swf_SetU8(tag,f->glyph2ascii[t]);
536 swf_SetU16(tag,f->layout->ascent);
537 swf_SetU16(tag,f->layout->descent);
538 swf_SetU16(tag,f->layout->leading);
539 for(t=0;t<f->numchars;t++)
540 swf_SetU16(tag,f->glyph[t].advance);
541 for(t=0;t<f->numchars;t++) {
542 swf_ResetWriteBits(tag);
543 swf_SetRect(tag,&f->layout->bounds[t]);
545 swf_SetU16(tag, f->layout->kerningcount);
546 for(t=0;t<f->layout->kerningcount;t++) {
547 if(flags & 4) /* wide codes */ {
548 swf_SetU8(tag,f->layout->kerning[t].char1);
549 swf_SetU8(tag,f->layout->kerning[t].char2);
551 swf_SetU16(tag,f->layout->kerning[t].char1);
552 swf_SetU16(tag,f->layout->kerning[t].char2);
554 swf_SetU16(tag,f->layout->kerning[t].adjustment);
560 void swf_FontAddLayout(SWFFONT * f, int ascent, int descent, int leading)
562 f->layout = (SWFLAYOUT*)malloc(sizeof(SWFLAYOUT));
563 f->layout->ascent = ascent;
564 f->layout->descent = descent;
565 f->layout->leading = leading;
566 f->layout->kerningcount = 0;
567 f->layout->kerning = 0;
568 f->layout->bounds = (SRECT*)malloc(sizeof(SRECT)*f->numchars);
569 memset(f->layout->bounds, 0, sizeof(SRECT)*f->numchars);
572 int swf_FontSetInfo(TAG * t,SWFFONT * f)
576 if ((!t)||(!f)) return -1;
577 swf_ResetWriteBits(t);
579 l = strlen(f->name); if (l>255) l = 255;
581 swf_SetBlock(t,f->name,l);
585 if(f->style & FONT_STYLE_BOLD)
587 if(f->style & FONT_STYLE_ITALIC)
589 if(f->style & FONT_ENCODING_ANSI)
591 if(f->style & FONT_ENCODING_SHIFTJIS)
593 if(f->style & FONT_ENCODING_UNICODE)
596 swf_SetU8(t,(flags&0xfe)|wide);
598 for (i=0;i<f->numchars;i++) {
599 if (f->glyph[i].shape)
600 wide?swf_SetU16(t,f->glyph2ascii[i]):
601 swf_SetU8(t,f->glyph2ascii[i]);
607 int swf_TextPrintDefineText(TAG * t,SWFFONT * f)
608 { int id = swf_GetTagID(t);
609 if ((id==ST_DEFINETEXT)||(id==ST_DEFINETEXT2)) swf_FontExtract_DefineText(f->id,f,t,FEDTJ_PRINT);
614 void swf_LayoutFree(SWFLAYOUT * l)
616 { if (l->kerning) free(l->kerning);
618 if (l->bounds) free(l->bounds);
624 void swf_FontFree(SWFFONT * f)
628 if (f->name) free(f->name);
629 if (f->layout) swf_LayoutFree(f->layout);
635 for (i=0;i<f->numchars;i++)
636 if (f->glyph[i].shape)
637 { swf_ShapeFree(f->glyph[i].shape);
638 f->glyph[i].shape = NULL;
644 free(f->ascii2glyph);
645 f->ascii2glyph = NULL;
648 free(f->glyph2ascii);
649 f->glyph2ascii = NULL;
655 int swf_TextSetInfoRecord(TAG * t,SWFFONT * font,U16 size,RGBA * color,S16 dx,S16 dy)
659 flags = TF_TEXTCONTROL|(font?TF_HASFONT:0)|(color?TF_HASCOLOR:0)|(dx?TF_HASXOFFSET:0)|(dy?TF_HASYOFFSET:0);
662 if (font) swf_SetU16(t,font->id);
664 { if (swf_GetTagID(t)==ST_DEFINETEXT2) swf_SetRGBA(t,color);
665 else swf_SetRGB(t,color);
667 if (dx) swf_SetS16(t,dx);
668 if (dy) swf_SetS16(t,dy);
669 if (font) swf_SetU16(t,size);
674 int swf_TextCountBits(SWFFONT * font,U8 * s,int scale,U8 * gbits,U8 * abits)
676 if ((!s)||(!font)||((!gbits)&&(!abits))||(!font->ascii2glyph)) return -1;
681 int glyph = font->ascii2glyph[s[0]];
683 g = swf_CountBits(glyph,g);
684 a = swf_CountBits((((U32)font->glyph[glyph].advance)*scale)/100,a);
689 if (gbits) gbits[0] = (U8)g;
690 if (abits) abits[0] = (U8)a;
695 int swf_TextSetCharRecord(TAG * t,SWFFONT * font,U8 * s,int scale,U8 gbits,U8 abits)
698 if ((!t)||(!font)||(!s)||(!font->ascii2glyph)) return -1;
701 if (l>0x7f) l = 0x7f;
706 int g = font->ascii2glyph[s[i]];
708 swf_SetBits(t,g,gbits);
709 swf_SetBits(t,(((U32)font->glyph[g].advance)*scale)/100,abits);
713 swf_ResetWriteBits(t);
717 U32 swf_TextGetWidth(SWFFONT * font,U8 * s,int scale)
723 int g = font->ascii2glyph[*s];
725 res += font->glyph[g].advance;
728 if (scale) res = (res*scale)/100;
733 SWFFONT* swf_ReadFont(char* filename)
739 f = open(filename,O_RDONLY);
741 if (f<0 || swf_ReadSWF(f,&swf)<0)
742 { fprintf(stderr,"%s is not a valid SWF font file or contains errors.\n",filename);
749 if(swf_FontExtract(&swf, WRITEFONTID, &font) < 0)
756 void swf_WriteFont(SWFFONT*font, char* filename)
762 int useDefineFont2 = 0;
765 useDefineFont2 = 1; /* the only thing new in definefont2
766 is layout information. */
768 font->id = WRITEFONTID; //"FN"
770 memset(&swf,0x00,sizeof(SWF));
773 swf.frameRate = 0x4000;
775 /* if we use DefineFont1 to store the characters,
776 we have to build a textfield to store the
777 advance values. While at it, we can also
778 make the whole .swf viewable */
780 /* we now always create viewable swfs, even if we
781 did use definefont2 -mk*/
782 t = swf_InsertTag(NULL,ST_SETBACKGROUNDCOLOR);
788 if(!useDefineFont2) {
789 t = swf_InsertTag(t,ST_DEFINEFONT);
790 swf_FontSetDefine(t,font);
791 t = swf_InsertTag(t,ST_DEFINEFONTINFO);
792 swf_FontSetInfo(t,font);
794 t = swf_InsertTag(t,ST_DEFINEFONT2);
795 swf_FontSetDefine2(t,font);
798 if(1) //useDefineFont2
799 { int textscale = 400;
802 int ymax = textscale * 2 * (font->maxascii/16+1);
804 char text[MAX_CHAR_PER_FONT+1];
806 text[MAX_CHAR_PER_FONT]=0;
807 for(s=0;s<font->maxascii;s++)
809 int g = font->ascii2glyph[s];
812 if(font->glyph[g].advance*textscale/64 > xmax)
813 xmax = font->glyph[g].advance*textscale/64;
816 swf.movieSize.xmax = xmax*20;
817 swf.movieSize.ymax = ymax;
819 t = swf_InsertTag(t,ST_DEFINETEXT);
821 swf_SetU16(t,font->id+1); // ID
825 r.xmax = swf.movieSize.xmax*20;
826 r.ymax = swf.movieSize.ymax;
830 swf_SetMatrix(t,NULL);
832 abits = swf_CountBits(xmax*16, 0);
841 for(y=0;y<=((font->maxascii-1)/16);y++)
846 int g = (y*16+x<font->maxascii)?font->ascii2glyph[y*16+x]:-1;
847 if(g>=0 && font->glyph[g].shape) {
854 swf_TextSetInfoRecord(t,font,textscale,&rgb,lastx+1,textscale*y*2);
857 int g = (y*16+x<font->maxascii)?font->ascii2glyph[y*16+x]:-1;
858 if(g>=0 && font->glyph[g].shape) {
859 if(lastx != x*xmax) {
860 swf_TextSetInfoRecord(t,0,0,0,x*xmax+1,0);
863 swf_SetBits(t, g, gbits);
864 swf_SetBits(t, font->glyph[g].advance, abits);
865 lastx = x*xmax+font->glyph[g].advance;
866 swf_ResetWriteBits(t);
874 t = swf_InsertTag(t,ST_PLACEOBJECT2);
876 swf_ObjectPlace(t,font->id+1,1,NULL,NULL,NULL);
878 t = swf_InsertTag(t,ST_SHOWFRAME);
881 t = swf_InsertTag(t,ST_END);
883 f = open(filename, O_RDWR|O_CREAT|O_TRUNC,0644);
884 if FAILED(swf_WriteSWF(f,&swf)) fprintf(stderr,"WriteSWF() failed in writeFont().\n");
891 void swf_SetEditText(TAG*tag, U16 flags, SRECT r, char*text, RGBA*color,
892 int maxlength, U16 font, U16 height, EditTextLayout*layout, char*variable)
895 swf_ResetWriteBits(tag);
897 flags &= ~(ET_HASTEXT|ET_HASTEXTCOLOR|ET_HASMAXLENGTH|ET_HASFONT|ET_HASLAYOUT);
898 if(text) flags |= ET_HASTEXT;
899 if(color) flags |= ET_HASTEXTCOLOR;
900 if(maxlength) flags |= ET_HASMAXLENGTH;
901 if(font) flags |= ET_HASFONT;
902 if(layout) flags |= ET_HASLAYOUT;
904 swf_SetBits(tag, flags, 16);
906 if(flags & ET_HASFONT) {
907 swf_SetU16(tag, font); //font
908 swf_SetU16(tag, height); //fontheight
910 if(flags & ET_HASTEXTCOLOR) {
911 swf_SetRGBA(tag, color);
913 if(flags & ET_HASMAXLENGTH) {
914 swf_SetU16(tag, maxlength); //maxlength
916 if(flags & ET_HASLAYOUT) {
917 swf_SetU8(tag,layout->align); //align
918 swf_SetU16(tag,layout->leftmargin); //left margin
919 swf_SetU16(tag,layout->rightmargin); //right margin
920 swf_SetU16(tag,layout->indent); //indent
921 swf_SetU16(tag,layout->leading); //leading
923 swf_SetString(tag, variable);
924 if(flags & ET_HASTEXT)
925 swf_SetString(tag,text);
928 void swf_SetDefineText(TAG*tag, SWFFONT*font, RGBA*rgb, char*text, int scale)
933 r.xmin = r.ymin = 0; /*FIXME*/
934 r.xmax = r.ymax = 1024*20;
937 swf_SetMatrix(tag,NULL);
938 swf_TextCountBits(font,text,scale,&gbits,&abits);
939 swf_SetU8(tag,gbits);
940 swf_SetU8(tag,abits);
941 swf_TextSetInfoRecord(tag,font,scale,rgb,0,scale);
942 swf_TextSetCharRecord(tag,font,text,scale,gbits,abits);