X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfc.c;h=c8827c14cf21ea1a4a3ecd25aaa34471e6dbd02e;hb=7c3e2529e63ade24a3878a86569e771721379dd3;hp=0a1bf112089b3d4cb307d31d2a7511dde1d97a31;hpb=bd936b85021d03bc16b12e54414f68e79593a59b;p=swftools.git diff --git a/src/swfc.c b/src/swfc.c index 0a1bf11..c8827c1 100644 --- a/src/swfc.c +++ b/src/swfc.c @@ -48,6 +48,7 @@ static int override_outputname = 0; static int do_cgi = 0; static int change_sets_all = 0; static int do_exports = 0; +static char * mainclass = ""; static struct options_t options[] = { {"h", "help"}, @@ -177,11 +178,13 @@ static struct level /* for swf (0): */ SWF*swf; char*filename; + char as3; /* for sprites (1): */ TAG*tag; U16 id; char*name; + char*as3name; U16 olddepth; int oldframe; dict_t oldinstances; @@ -340,22 +343,22 @@ static void free_outline(void* o) static void freeDictionaries() { - dict_free_all(&instances, free_instance); - dict_free_all(&characters, free); - dict_free_all(&images, free); - dict_free_all(&textures, free); - dict_free_all(&outlines, free_outline); - dict_free_all(&gradients, free_gradient); - dict_free_all(&filters, free); - dict_free_all(&fonts, free_font); - dict_free_all(&sounds, free); - dict_free_all(&interpolations, free); + dict_free_all(&instances, 1, free_instance); + dict_free_all(&characters, 1, free); + dict_free_all(&images, 1, free); + dict_free_all(&textures, 1, free); + dict_free_all(&outlines, 1, free_outline); + dict_free_all(&gradients, 1, free_gradient); + dict_free_all(&filters, 1, free); + dict_free_all(&fonts, 1, free_font); + dict_free_all(&sounds, 1, free); + dict_free_all(&interpolations, 1, free); cleanUp = 0; } static void freeFontDictionary() { - dict_free_all(&fonts, free_font); + dict_free_all(&fonts, 1, free_font); } static void incrementid() @@ -377,7 +380,7 @@ static void s_addcharacter(const char*name, U16 id, TAG*ctag, SRECT r) c->definingTag = ctag; c->id = id; c->size = r; - dict_put2(&characters, name, c); + dict_put(&characters, name, c); if(do_exports) { tag = swf_InsertTag(tag, ST_NAMECHARACTER); @@ -398,7 +401,7 @@ static void s_addimage(const char*name, U16 id, TAG*ctag, SRECT r) c->definingTag = ctag; c->id = id; c->size = r; - dict_put2(&images, name, c); + dict_put(&images, name, c); } static instance_t* s_addinstance(const char*name, character_t*c, U16 depth) { @@ -408,7 +411,7 @@ static instance_t* s_addinstance(const char*name, character_t*c, U16 depth) i->character = c; i->depth = depth; //swf_GetMatrix(0, &i->matrix); - dict_put2(&instances, name, i); + dict_put(&instances, name, i); return i; } @@ -471,89 +474,89 @@ void initBuiltIns() interpolation_t* new; new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_LINEAR; - dict_put2(&interpolations, "linear", new); + dict_put(&interpolations, "linear", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_QUAD_IN; new->slope = 0; - dict_put2(&interpolations, "quadIn", new); + dict_put(&interpolations, "quadIn", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_QUAD_OUT; new->slope = 0; - dict_put2(&interpolations, "quadOut", new); + dict_put(&interpolations, "quadOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_QUAD_IN_OUT; new->slope = 0; - dict_put2(&interpolations, "quadInOut", new); + dict_put(&interpolations, "quadInOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_CUBIC_IN; new->slope = 0; - dict_put2(&interpolations, "cubicIn", new); + dict_put(&interpolations, "cubicIn", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_CUBIC_OUT; new->slope = 0; - dict_put2(&interpolations, "cubicOut", new); + dict_put(&interpolations, "cubicOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_CUBIC_IN_OUT; new->slope = 0; - dict_put2(&interpolations, "cubicInOut", new); + dict_put(&interpolations, "cubicInOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_QUART_IN; new->slope = 0; - dict_put2(&interpolations, "quartIn", new); + dict_put(&interpolations, "quartIn", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_QUART_OUT; new->slope = 0; - dict_put2(&interpolations, "quartOut", new); + dict_put(&interpolations, "quartOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_QUART_IN_OUT; new->slope = 0; - dict_put2(&interpolations, "quartInOut", new); + dict_put(&interpolations, "quartInOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_QUINT_IN; new->slope = 0; - dict_put2(&interpolations, "quintIn", new); + dict_put(&interpolations, "quintIn", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_QUINT_OUT; new->slope = 0; - dict_put2(&interpolations, "quintOut", new); + dict_put(&interpolations, "quintOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_QUINT_IN_OUT; new->slope = 0; - dict_put2(&interpolations, "quintInOut", new); + dict_put(&interpolations, "quintInOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_CIRCLE_IN; - dict_put2(&interpolations, "circleIn", new); + dict_put(&interpolations, "circleIn", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_CIRCLE_OUT; - dict_put2(&interpolations, "circleOut", new); + dict_put(&interpolations, "circleOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_CIRCLE_IN_OUT; - dict_put2(&interpolations, "circleInOut", new); + dict_put(&interpolations, "circleInOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_EXPONENTIAL_IN; - dict_put2(&interpolations, "exponentialIn", new); + dict_put(&interpolations, "exponentialIn", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_EXPONENTIAL_OUT; - dict_put2(&interpolations, "exponentialOut", new); + dict_put(&interpolations, "exponentialOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_EXPONENTIAL_IN_OUT; - dict_put2(&interpolations, "exponentialInOut", new); + dict_put(&interpolations, "exponentialInOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_SINE_IN; - dict_put2(&interpolations, "sineIn", new); + dict_put(&interpolations, "sineIn", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_SINE_OUT; - dict_put2(&interpolations, "sineOut", new); + dict_put(&interpolations, "sineOut", new); new = (interpolation_t*)malloc(sizeof(interpolation_t)); new->function = IF_SINE_IN_OUT; - dict_put2(&interpolations, "sineInOut", new); + dict_put(&interpolations, "sineInOut", new); RGBA c; memset(&c, 0, sizeof(RGBA)); @@ -567,29 +570,29 @@ void initBuiltIns() noGradient->gradient.ratios[1] = 255; noGradient->radial = 0; noGradient->rotate = 0; - dict_put2(&gradients, "no_gradient", noGradient); + dict_put(&gradients, "no_gradient", noGradient); noFilters = 0; // put a no_filters entry in the filters dictionary to provoce a message when a user tries // to define a no_filters filter. The real filter=no_filters case is handled in parseFilters. FILTER* dummy = (FILTER*)malloc(sizeof(FILTER)); - dict_put2(&filters, "no_filters", dummy); + dict_put(&filters, "no_filters", dummy); noBlur = (FILTER_BLUR*) swf_NewFilter(FILTERTYPE_BLUR); noBlur->passes = 1; - dict_put2(&filters, "no_blur", noBlur); + dict_put(&filters, "no_blur", noBlur); noBevel = (FILTER_BEVEL*) swf_NewFilter(FILTERTYPE_BEVEL); noBevel->passes = 1; noBevel->composite = 1; - dict_put2(&filters, "no_bevel", noBevel); + dict_put(&filters, "no_bevel", noBevel); noDropshadow = (FILTER_DROPSHADOW*) swf_NewFilter(FILTERTYPE_DROPSHADOW); noDropshadow->passes = 1; noDropshadow->composite = 1; - dict_put2(&filters, "no_dropshadow", noDropshadow); + dict_put(&filters, "no_dropshadow", noDropshadow); noGradientGlow = (FILTER_GRADIENTGLOW*) swf_NewFilter(FILTERTYPE_GRADIENTGLOW); noGradientGlow->passes = 1; noGradientGlow->composite = 1; noGradientGlow->gradient = &noGradient->gradient; - dict_put2(&filters, "no_gradientglow", noGradientGlow); + dict_put(&filters, "no_gradientglow", noGradientGlow); } void s_swf(const char*name, SRECT r, int version, int fps, int compress, RGBA background) @@ -609,15 +612,15 @@ void s_swf(const char*name, SRECT r, int version, int fps, int compress, RGBA ba swf->compressed = compress; swf_SetRGB(tag,&background); - dict_init(&characters); - dict_init(&images); - dict_init(&textures); - dict_init(&outlines); - dict_init(&gradients); - dict_init(&filters); - dict_init(&instances); - dict_init(&sounds); - dict_init(&interpolations); + dict_init(&characters, 16); + dict_init(&images, 16); + dict_init(&textures, 16); + dict_init(&outlines, 16); + dict_init(&gradients, 16); + dict_init(&filters, 16); + dict_init(&instances, 16); + dict_init(&sounds, 16); + dict_init(&interpolations, 16); initBuiltIns(); cleanUp = &freeDictionaries; @@ -633,10 +636,12 @@ void s_swf(const char*name, SRECT r, int version, int fps, int compress, RGBA ba currentdepth = 1; memset(idmap, 0, sizeof(idmap)); + idmap[0]=1; //main movie has ID 0 + incrementid(); } -void s_sprite(const char*name, SRECT*scalegrid) +void s_sprite(const char*name, SRECT*scalegrid, const char*as3name) { tag = swf_InsertTag(tag, ST_DEFINESPRITE); swf_SetU16(tag, id); //id @@ -651,6 +656,7 @@ void s_sprite(const char*name, SRECT*scalegrid) stack[stackpos].tag = tag; stack[stackpos].id = id; stack[stackpos].name = strdup(name); + stack[stackpos].as3name = strdup(as3name); if(scalegrid) { stack[stackpos].scalegrid = *scalegrid; } else { @@ -658,7 +664,7 @@ void s_sprite(const char*name, SRECT*scalegrid) } /* FIXME: those four fields should be bundled together */ - dict_init(&instances); + dict_init(&instances, 16); currentframe = 0; currentdepth = 1; memset(¤trect, 0, sizeof(currentrect)); @@ -684,7 +690,7 @@ typedef struct _button static button_t mybutton; -void s_button(const char*name) +void s_button(const char*name, const char*as3name) { tag = swf_InsertTag(tag, ST_DEFINEBUTTON2); swf_SetU16(tag, id); //id @@ -697,6 +703,7 @@ void s_button(const char*name) stack[stackpos].tag = tag; stack[stackpos].id = id; stack[stackpos].name = strdup(name); + stack[stackpos].as3name = strdup(as3name); stack[stackpos].oldrect = currentrect; memset(¤trect, 0, sizeof(currentrect)); @@ -813,6 +820,14 @@ static void s_endButton() currentrect = stack[stackpos].oldrect; s_addcharacter(stack[stackpos].name, stack[stackpos].id, stack[stackpos].tag, r); + + if(*stack[stackpos].as3name) { + tag = swf_InsertTag(tag, ST_SYMBOLCLASS); + swf_SetU16(tag, 1); + swf_SetU16(tag, stack[stackpos].id); + swf_SetString(tag, stack[stackpos].as3name); + } + free(stack[stackpos].name); } @@ -991,7 +1006,7 @@ static void s_endSprite() syntaxerror("internal error(7)"); /* TODO: before clearing, prepend "." to names and copy into old instances dict */ - dict_free_all(&instances, free_instance); + dict_free_all(&instances, 1, free_instance); currentframe = stack[stackpos].oldframe; currentrect = stack[stackpos].oldrect; @@ -999,6 +1014,15 @@ static void s_endSprite() instances = stack[stackpos].oldinstances; s_addcharacter(stack[stackpos].name, stack[stackpos].id, stack[stackpos].tag, r); + + if(*stack[stackpos].as3name) { + tag = swf_InsertTag(tag, ST_SYMBOLCLASS); + swf_SetU16(tag, 1); + swf_SetU16(tag, stack[stackpos].id); + swf_SetString(tag, stack[stackpos].as3name); + } + + free(stack[stackpos].name); } @@ -1007,6 +1031,7 @@ static void s_endSWF() int fi; SWF* swf; char*filename; + char*mc=""; dict_foreach_value(&instances, writeInstance); @@ -1027,6 +1052,26 @@ static void s_endSWF() // tag = swf_InsertTag(tag, ST_SHOWFRAME); tag = swf_InsertTag(tag, ST_SHOWFRAME); + if(stack[0].as3) { + TAG*tag = swf->firstTag; + tag = swf_InsertTag(tag, ST_DOABC); + void*code = as3_getcode(); + swf_WriteABC(tag, code); + if (*mainclass) + mc = mainclass; + else if (as3_getglobalclass()) + mc = as3_getglobalclass(); + if(*mc) { + tag = swf_InsertTag(tag, ST_SYMBOLCLASS); + swf_SetU16(tag, 1); + swf_SetU16(tag, 0); + swf_SetString(tag, mc); + } else { + warning("no global public MovieClip subclass"); + } + as3_destroy(); + } + tag = swf_InsertTag(tag, ST_END); swf_OptimizeTagOrder(swf); @@ -1314,7 +1359,7 @@ void s_textshape(const char*name, const char*fontname, float size, const char*_t if(dict_lookup(&outlines, name)) syntaxerror("outline %s defined twice", name); - dict_put2(&outlines, name, outline); + dict_put(&outlines, name, outline); } void s_text(const char*name, const char*fontname, const char*text, int size, RGBA color) @@ -1362,6 +1407,24 @@ void s_quicktime(const char*name, const char*url) incrementid(); } +void s_video(const char *name, int width, int height) +{ + SRECT r; + + memset(&r, 0, sizeof(r)); + + tag = swf_InsertTag(tag, ST_DEFINEVIDEOSTREAM); + swf_SetU16(tag, id); + swf_SetU16(tag, 0); // numframes + swf_SetU16(tag, width); + swf_SetU16(tag, height); + swf_SetU8(tag, 0); // videoflags + swf_SetU8(tag, 0); // codecid + + s_addcharacter(name, id, tag, r); + incrementid(); +} + void s_edittext(const char*name, const char*fontname, int size, int width, int height, const char*text, RGBA*color, int maxlength, const char*variable, int flags, int align) { SWFFONT*font = 0; @@ -1523,7 +1586,7 @@ void s_texture(const char*name, const char*object, int x, int y, float scalex, f fs->m.sy *= 20; } - dict_put2(&textures, name, texture); + dict_put(&textures, name, texture); } void s_font(const char*name, const char*filename) @@ -1645,7 +1708,7 @@ void s_sound(const char*name, const char*filename) sound->tag = tag; sound->id = id; - dict_put2(&sounds, name, sound); + dict_put(&sounds, name, sound); incrementid(); @@ -1767,7 +1830,7 @@ void s_gradient(const char*name, const char*text, int radial, int rotate) gradient->radial = radial; gradient->rotate = rotate; - dict_put2(&gradients, name, gradient); + dict_put(&gradients, name, gradient); } void s_gradientglow(const char*name, const char*gradient, float blurx, float blury, @@ -1797,7 +1860,7 @@ void s_gradientglow(const char*name, const char*gradient, float blurx, float blu filter->ontop = ontop; filter->passes = passes; - dict_put2(&filters, name, filter); + dict_put(&filters, name, filter); } void s_dropshadow(const char*name, RGBA color, double blurx, double blury, double angle, double distance, double strength, char innershadow, char knockout, char composite, int passes) @@ -1819,7 +1882,7 @@ void s_dropshadow(const char*name, RGBA color, double blurx, double blury, doubl filter->composite = composite; filter->passes = passes; - dict_put2(&filters, name, filter); + dict_put(&filters, name, filter); } void s_bevel(const char*name, RGBA shadow, RGBA highlight, double blurx, double blury, double angle, double distance, double strength, char innershadow, char knockout, char composite, char ontop, int passes) @@ -1843,7 +1906,7 @@ void s_bevel(const char*name, RGBA shadow, RGBA highlight, double blurx, double filter->ontop = ontop; filter->passes = passes; - dict_put2(&filters, name, filter); + dict_put(&filters, name, filter); } void s_blur(const char*name, double blurx, double blury, int passes) @@ -1857,24 +1920,25 @@ void s_blur(const char*name, double blurx, double blury, int passes) filter->blury = blury; filter->passes = passes; - dict_put2(&filters, name, filter); + dict_put(&filters, name, filter); } void s_action(const char*text) { - ActionTAG* a = 0; - a = swf_ActionCompile(text, stack[0].swf->fileVersion); - if(!a) - { + if(stack[0].swf->fileVersion < 9) { + ActionTAG* a = 0; + a = swf_ActionCompile(text, stack[0].swf->fileVersion); + if(!a) { + swf_ActionFree(a); + syntaxerror("Couldn't compile ActionScript"); + } + tag = swf_InsertTag(tag, ST_DOACTION); + swf_ActionSet(tag, a); swf_ActionFree(a); - syntaxerror("Couldn't compile ActionScript"); + } else { + as3_parse_bytearray(stack[0].filename, text, strlen(text)); + stack[0].as3 = 1; } - - tag = swf_InsertTag(tag, ST_DOACTION); - - swf_ActionSet(tag, a); - - swf_ActionFree(a); } void s_initaction(const char*character, const char*text) @@ -1946,7 +2010,7 @@ void s_outline(const char*name, const char*format, const char*source) outline->shape = shape; outline->bbox = bounds; - dict_put2(&outlines, name, outline); + dict_put(&outlines, name, outline); } int s_playsound(const char*name, int loops, int nomultiple, int stop) @@ -2694,7 +2758,7 @@ float parsePercent(const char*str) if(!l) return 1.0; if(str[l-1]=='%') { - return atoi(str)/100.0; + return atof(str)/100.0; } syntaxerror("Expression '%s' is not a percentage", str); return 0; @@ -2768,6 +2832,7 @@ static int c_flash(map_t*args) syntaxerror("value \"%s\" not supported for the change-sets-all argument", change_modestr); do_exports=atoi(exportstr); + mainclass=strdup(lu(args, "mainclass")); s_swf(filename, bbox, version, fps, compress, color); return 0; @@ -2825,7 +2890,7 @@ static int c_interpolation(map_t *args) inter->damping = parseFloat(lu(args, "damping")); inter->slope = parseFloat(lu(args, "slope")); - dict_put2(&interpolations, name, inter); + dict_put(&interpolations, name, inter); return 0; } @@ -3114,33 +3179,29 @@ static int c_define(map_t*args) const char*value = lu(args, "value"); if(!defines_initialized) { - dict_init(&defines); + dict_init(&defines, 16); mem_init(&define_values); defines_initialized = 1; } int val = parseTwip(value); int pos = mem_put(&define_values, &val, sizeof(val)); - string_t s; - string_set(&s, name); - dict_put(&defines, s, (void*)(pos+1)); + dict_put(&defines, name, (void*)(pos+1)); return 0; } static int c_point(map_t*args) { const char*name = lu(args, "name"); int pos; - string_t s1; SPOINT p; if(!points_initialized) { - dict_init(&points); + dict_init(&points, 16); mem_init(&mpoints); points_initialized = 1; } p.x = parseTwip(lu(args, "x")); p.y = parseTwip(lu(args, "y")); pos = mem_put(&mpoints, &p, sizeof(p)); - string_set(&s1, name); - dict_put(&points, s1, (void*)(pos+1)); + dict_put(&points, name, (void*)(pos+1)); return 0; } static int c_play(map_t*args) @@ -3662,12 +3723,13 @@ static int c_sprite(map_t*args) { const char* name = lu(args, "name"); const char* scalinggrid = lu(args, "scalinggrid"); + const char* as3name = lu(args, "as3name"); if(scalinggrid && *scalinggrid) { SRECT r = parseBox(scalinggrid); - s_sprite(name, &r); + s_sprite(name, &r, as3name); } else { - s_sprite(name, 0); + s_sprite(name, 0, as3name); } return 0; } @@ -3806,6 +3868,15 @@ static int c_quicktime(map_t*args) return 0; } +static int c_video(map_t*args) +{ + const char*name = lu(args, "name"); + int width = parseInt(lu(args, "width")); + int height = parseInt(lu(args, "height")); + s_video(name, width, height); + return 0; +} + static int c_image(map_t*args) { const char*command = lu(args, "commandname"); @@ -3843,7 +3914,8 @@ int fakechar(map_t*args) static int c_egon(map_t*args) {return fakechar(args);} static int c_button(map_t*args) { const char*name = lu(args, "name"); - s_button(name); + const char*as3name = lu(args, "as3name"); + s_button(name, as3name); return 0; } static int current_button_flags = 0; @@ -4063,7 +4135,7 @@ static struct { command_func_t* func; char*arguments; } arguments[] = -{{"flash", c_flash, "bbox=autocrop background=black version=6 fps=50 name= filename= @compress=default @change-sets-all=no @export=1"}, +{{"flash", c_flash, "bbox=autocrop background=black version=6 fps=50 name= filename= @compress=default @change-sets-all=no @export=1 @mainclass="}, {"frame", c_frame, "n=1 name= @cut=no @anchor=no"}, // "import" type stuff {"swf", c_swf, "name filename"}, @@ -4075,6 +4147,7 @@ static struct { {"font", c_font, "name filename glyphs="}, {"soundtrack", c_soundtrack, "filename"}, {"quicktime", c_quicktime, "url"}, + {"video", c_video, "name width= height="}, // generators of primitives @@ -4100,7 +4173,7 @@ static struct { {"text", c_text, "name text font size=100% color=white"}, {"edittext", c_edittext, "name font= size=100% width height text="" color=white maxlength=0 variable="" @password=0 @wordwrap=0 @multiline=0 @html=0 @noselect=0 @readonly=0 @border=0 @autosize=0 align="}, {"morphshape", c_morphshape, "name start end"}, - {"button", c_button, "name"}, + {"button", c_button, "name as3name="}, {"show", c_show, "name x=0 y=0 red=+0 green=+0 blue=+0 alpha=+0 luminance= scale= scalex= scaley= blend= filter= pivot= pin= shear= rotate= ratio= above= below= as="}, {"on_press", c_on_press, "position=inside"}, {"on_release", c_on_release, "position=anywhere"}, @@ -4132,7 +4205,7 @@ static struct { // commands which start a block //startclip (see above) - {"sprite", c_sprite, "name scalinggrid="}, + {"sprite", c_sprite, "name scalinggrid= as3name="}, {"action", c_action, "filename="}, {"initaction", c_initaction, "name filename="}, @@ -4412,21 +4485,22 @@ static void analyseArgumentsForCommand(char*command) { if (strcmp (glyphs_to_include, "")) { - swf_FontUseUTF8(font, glyphs_to_include); + swf_FontUseUTF8(font, glyphs_to_include, /*FIXME*/0xffff); font->use->glyphs_specified = 1; } else swf_FontInitUsage(font); } } - dict_put2(&fonts, name, font); + dict_put(&fonts, name, font); } else { SWFFONT* font = dict_lookup(&fonts, lu(&args, "font")); - if (!font) - syntaxerror("font %s is not known in line %d", lu(&args, "font"), line); - else + if (!font) { + //that's ok... it might be an edittext with a system font + //syntaxerror("font %s is not known in line %d", lu(&args, "font"), line); + } else if (font->use && !font->use->glyphs_specified) { if (!strcmp(command, "edittext")) @@ -4435,7 +4509,7 @@ static void analyseArgumentsForCommand(char*command) font->use->glyphs_specified = 1; } else - swf_FontUseUTF8(font, (U8*)lu(&args, "text")); + swf_FontUseUTF8(font, (U8*)lu(&args, "text"), 0xffff); } } map_clear(&args); @@ -4470,7 +4544,7 @@ void firstPass() { pos = 0; id = 0; - dict_init(&fonts); + dict_init(&fonts, 16); cleanUp = &freeFontDictionary; findFontUsage(); }