[swfmill] Decoding DefineFont or compiling swfmill under windows
iceyshard at gmail.com
Sat Jul 19 12:04:12 PDT 2008
> I want to programatically, make changes on several Strings in a SWF file, so I decided to use Swfmill.
> I tried to decode the data string in DefineFont tags, I noticed they are in Base64 [...]
> I would appreciate very much help in any of the following situations:
> 1. Decode the string in DefineFont2 tag.
> 2. Compile swfmill under Windows.
Hi. Umm, I don't know much, but hopefully I'll be able to provide some
I think DefineFont does just that- it defines a FONT, to be used by
later objects actually containing the text.
I just xml2swf ed some movie and found something like this:
<DefineFont2 objectID="49" ...
This part defined the shapes of letters- glyphs.
If I'm guessing right, the font in your example isn't true type, and
instead of <ShapeSetup... and stuff, you get something like
bunch of base64 data
If that's the case, the rest of my message may help.
If, instead, the whole font is somehow encapsulated as a bunch of
base64 data, then I'm not sure what to do, you'd probably need to
transform the whole block of data into an .fnt file or something and
somehow analyze that.
Anyways, in my swf2xml, after the font was defined, there was a
DefineText2 tag, with stuff in it.
<Rectangle left="0" right="7120" top="0" bottom="1320" />
<Transform transX="0" transY="0" />
<TextRecord72 fontRef="49" x="1587" y="466" fontHeight="480">
<Color red="0" green="0" blue="0" alpha="255" />
<TextEntry2 glyph="7" advance="0" />
Notice how the TextRecord2 has fontRef="49"- it instructs it to draw
the data from the font defined earlier with objectID="49".
Then <TextEntry2 glyph="x" ... /> seems to be instruction to place the
given glyph/letter. Note, glyph="0" is the first glyph defined in the
DefineFont, glyph="1" is the second, ect., their ASCII codes are in
map="" argument in the <glyph ...> in DefineFont2, so in my example
glyph="0" has ascii=32 that is, it's space.
Based on that, I quickly managed to change a text saying "Mid" into
"Sad", except S and a were in slightly weird places, but I suppose
tinkering with x-es and y-es would fix it.
I also noticed another type of text object, it looked like this:
<DefineEditText objectID="52" .... initialText="<P
ALIGN="LEFT"><FONT COLOR="#dd0000" FACE="Arial" SIZE="12">Initial
<Rectangle left="0" right="7800" top="0" bottom="400" />
But since the string is present in plain text here, and I assume you
did try using search to find your target strings, it's probably not
the one used in your swf.
As for compliling under Windows, I just managed to do it in MinGW a
couple of days ago.
The main problem I had was with all the libraries:
libxml2, libxml2dev, libxslt, libiconv, zlib, freetext, libpng
and perhaps one or two more :S, I'm not sure, I kinda lost track of
stuff I was downloading and installing. o_@
Make sure you have them all, and that they're properly installed in
Hope that helps.
More information about the swfmill