[prev in list] [next in list] [prev in thread] [next in thread] 

List:       swftools-common
Subject:    [Swftools-common] pdf2swf: text flips with "-T 9" argument
From:       Justin.Liebeskind () onevision ! com
Date:       2010-03-30 12:45:47
Message-ID: OFACA12798.813D8346-ON852576F6.0045C6A4-852576F6.004609B0 () onevision ! de
[Download RAW message or body]

This is a multipart message in MIME format.
--=_alternative 00460708852576F6_=
Content-Type: text/plain; charset="US-ASCII"

Hello Swftools,

I am not sure if this is the right place to ask about bugs, but I could 
not find any other.
Please direct me to the correct place if there is one...

Anyways, I have an issue with pdf2swf where text gets flipped in the 
outputted SWF.
This happens in all SWF viewers and it happens with almost all of my 
generated SWF files.
It is reproducible by simply shrinking the viewing window -- at a certain 
point, the text will suddenly flip.

Upon further investigation, it seemed to be related to using the "-T 9" 
argument of pdf2swf.
Without this argument, the problem goes away.
However, I need to use this argument...

I diffed two swfdumps - one using "-T 9" and one not using it.
The issue seems to be with the CSMTextSettings property.
See page 208 of the SWF Spec:
www.adobe.com/devnet/swf/pdf/swf_file_format_spec_v9.pdf 

The GridFit field is being set to 1 by pdf2swf, but this is only supported 
with left-aligned dynamic text.
pdf2swf seems to violate this spec.
If I manually fix the SWF to have this field set to 0, then my problem 
goes away.

After grabbing the source for swftools, it looks like there are two places 
where this problem occurs:
swftools-0.9.0/lib/devices/swf.c, line 768
and
swftools-0.9.0/src/swf.c, line 1359

Example:
 if(stack[0].swf->fileVersion >= 8) {
        tag = swf_InsertTag(tag, ST_CSMTEXTSETTINGS);
        swf_SetU16(tag, id);
        //swf_SetU8(tag, /*grid*/(1<<3)|/*flashtype*/0x40);  //old
        swf_SetU8(tag, /*grid*/(0)|/*flashtype*/0x40);  //new. grid 
fitting only supported for left-aligned dynamic text.
        swf_SetU32(tag, 0);//thickness
        swf_SetU32(tag, 0);//sharpness
        swf_SetU8(tag, 0);//reserved
    }


This is my first time looking at the source code, so I am afraid that I 
will screw it up if I try to fix this issue myself.
A developer more familiar with the code base would probably know more 
about what is going on with this setting.

Please help!

Thank you,
-Justin Liebeskind
Justin.Liebeskind@onevision.com
--=_alternative 00460708852576F6_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">Hello Swftools,</font>
<br>
<br><font size=2 face="sans-serif">I am not sure if this is the right place
to ask about bugs, but I could not find any other.</font>
<br><font size=2 face="sans-serif">Please direct me to the correct place
if there is one...</font>
<br>
<br><font size=2 face="sans-serif">Anyways, I have an issue with pdf2swf
where text gets flipped in the outputted SWF.</font>
<br><font size=2 face="sans-serif">This happens in all SWF viewers and
it happens with almost all of my generated SWF files.</font>
<br><font size=2 face="sans-serif">It is reproducible by simply shrinking
the viewing window -- at a certain point, the text will suddenly flip.</font>
<br>
<br><font size=2 face="sans-serif">Upon further investigation, it seemed
to be related to using the &quot;-T 9&quot; argument of pdf2swf.</font>
<br><font size=2 face="sans-serif">Without this argument, the problem goes
away.</font>
<br><font size=2 face="sans-serif">However, I need to use this argument...</font>
<br>
<br><font size=2 face="sans-serif">I diffed two swfdumps - one using &quot;-T
9&quot; and one not using it.</font>
<br><font size=2 face="sans-serif">The issue seems to be with the CSMTextSettings
property.</font>
<br><font size=2 face="sans-serif">See page 208 of the SWF Spec:</font>
<br><font size=2 face="sans-serif">www.adobe.com/devnet/swf/pdf/swf_file_format_spec_v9.pdf
</font>
<br>
<br><font size=2 face="sans-serif">The GridFit field is being set to 1
by pdf2swf, but this is only supported with left-aligned dynamic text.</font>
<br><font size=2 face="sans-serif">pdf2swf seems to violate this spec.</font>
<br><font size=2 face="sans-serif">If I manually fix the SWF to have this
field set to 0, then my problem goes away.</font>
<br>
<br><font size=2 face="sans-serif">After grabbing the source for swftools,
it looks like there are two places where this problem occurs:</font>
<br><font size=2 face="sans-serif">swftools-0.9.0/lib/devices/swf.c, line
768</font>
<br><font size=2 face="sans-serif">and</font>
<br><font size=2 face="sans-serif">swftools-0.9.0/src/swf.c, line 1359</font>
<br>
<br><font size=2 face="sans-serif">Example:</font>
<br><font size=2 face="sans-serif">&nbsp;if(stack[0].swf-&gt;fileVersion
&gt;= 8) {</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; tag
= swf_InsertTag(tag, ST_CSMTEXTSETTINGS);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; swf_SetU16(tag,
id);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; //swf_SetU8(tag,
/*grid*/(1&lt;&lt;3)|/*flashtype*/0x40); &nbsp;//old</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; swf_SetU8(tag,
/*grid*/(0)|/*flashtype*/0x40); &nbsp;//new. grid fitting only supported
for left-aligned dynamic text.</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; swf_SetU32(tag,
0);//thickness</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; swf_SetU32(tag,
0);//sharpness</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; swf_SetU8(tag,
0);//reserved</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; }</font>
<br>
<br>
<br><font size=2 face="sans-serif">This is my first time looking at the
source code, so I am afraid that I will screw it up if I try to fix this
issue myself.</font>
<br><font size=2 face="sans-serif">A developer more familiar with the code
base would probably know more about what is going on with this setting.</font>
<br>
<br><font size=2 face="sans-serif">Please help!</font>
<br>
<br><font size=2 face="sans-serif">Thank you,</font>
<br><font size=2 face="sans-serif">-Justin Liebeskind</font>
<br><font size=2 face="sans-serif">Justin.Liebeskind@onevision.com</font>
--=_alternative 00460708852576F6_=--



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic