[swfmill] duplicating chars of TrueType font glyphs makes the output swf file big
matsuhashi@quick.co.jp
matsuhashi at quick.co.jp
Thu Feb 8 01:39:34 EST 2007
Hi, list
I am going to propose a patch to swfmill-0.2.12.
At first, let me remind the issue I previously posted.
I made a small movie definition xml as follows:
-------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<movie width="330" height="100" framerate="12">
<background color="#FFFF00"/>
<frame>
<!-- import the numerical characters of vera.ttf -->
<font id="MSGOTHIC" import="C:\WINNT\Fonts\MSGOTHIC.TTC" glyphs=
"クい01234501234500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
/><!-- クい012345012345 -->
<textfield id="ku_i_0" width="640" height="100" size="80" font=
"MSGOTHIC" text="クい012345"/>
<place id="ku_i_0" name="output" depth="10"/>
</frame>
</movie>
-------------------------------------------------------------------
Please note the <font> tag has silly-long repetition of character zero '0'.
I processed this movie definition with swfmill-0.2.12 to get a swf file.
The created swf file had length of 1120 bytes. Then I further processed the
swf file with "swf2xml" command to get a XML file. The created SWFML file
had length of 152164 bytes. This big!
Why the created SWFML file became so big? The reason was simple. The SWFML
file contained <Glyph map="48"> node, which represents the character zero
'0', repeated as often as specified in the input glyphs attribute of <font>
tag.
<Glyph map="48">
<GlyphShape>
<edges>
<ShapeSetup x="128" y="-732" fillStyle0="1"/>
<CurveTo x1="56" y1="-56" x2="68" y2="0"/>
<CurveTo x1="68" y1="0" x2="56" y2="56"/>
<CurveTo x1="96" y1="96" x2="0" y2="236"/>
<CurveTo x1="0" y1="240" x2="-96" y2="96"/>
<CurveTo x1="-56" y1="56" x2="-68" y2="0"/>
<CurveTo x1="-68" y1="0" x2="-56" y2="-56"/>
<CurveTo x1="-96" y1="-96" x2="0" y2="-240"/>
<CurveTo x1="0" y1="-236" x2="96" y2="-96"/>
<ShapeSetup x="304" y="-688" fillStyle0="1"/>
<CurveTo x1="-24" y1="-24" x2="-28" y2="0"/>
<CurveTo x1="-28" y1="0" x2="-24" y2="24"/>
<CurveTo x1="-76" y1="80" x2="0" y2="208"/>
<CurveTo x1="0" y1="216" x2="76" y2="76"/>
<CurveTo x1="24" y1="24" x2="28" y2="0"/>
<CurveTo x1="28" y1="0" x2="24" y2="-24"/>
<CurveTo x1="76" y1="-76" x2="0" y2="-216"/>
<CurveTo x1="0" y1="-212" x2="-76" y2="-76"/>
<ShapeSetup/>
</edges>
</GlyphShape>
</Glyph>
<Glyph map="48">...
<Glyph map="48">...
<Glyph map="48">...
<Glyph map="48">...
...long long repetition continues
I think that the repetition of <Glyph> of a single character is just
redundant and unnecessary. I thought it is desirable if swfmill can make
the array of <Glyph> tags unique even if the movie definition xml has silly
repetition of a character.
Now I would like to propose a patch to swfmill-0.2.12
(src/swft/swft_import_ttf.cpp).
(See attached file: diff.txt)
The patch worked for me. Using the same movie definition xml, I got a swf
file of 816 bytes, a SWFML file of 11549 bytes. Much shortened.
MATSUHASHI,kazuaki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff.txt
Type: application/octet-stream
Size: 2265 bytes
Desc: not available
Url : http://osflash.org/pipermail/swfmill_osflash.org/attachments/20070208/025423ca/ISO-2022-JPBZGlmZi50eHQ.obj
More information about the swfmill
mailing list