[swfmill] Decoding DefineFont or compiling swfmill under windows
Icey Shard
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
insight...
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" ...
<glyphs>
<Glyph map="32">
<GlyphShape>
<edges>
<ShapeSetup
.
.
.
</DefineFont2>
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
<DefineBitLossLess>
bunch of base64 data
</DefineBitLossLess>
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.
<DefineText2 objectID="48">
<bounds>
<Rectangle left="0" right="7120" top="0" bottom="1320" />
</bounds>
<transform>
<Transform transX="0" transY="0" />
</transform>
<records>
<TextRecord2>
<textString>
<TextRecord72 fontRef="49" x="1587" y="466" fontHeight="480">
<color>
<Color red="0" green="0" blue="0" alpha="255" />
</color>
<glyphs>
<TextEntry2 glyph="7" advance="0" />
</glyphs>
</TextRecord72>
</textString>
</TextRecord2>
.
.
.
</records></DefineText2>
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
Text</FONT></P>">
<size>
<Rectangle left="0" right="7800" top="0" bottom="400" />
</size>
</DefineEditText>
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
your compiler.
Hope that helps.
More information about the swfmill
mailing list