I just started looking at using swfTools to convert PDF documents to flash AS3 files and I ran into this same problem. This problem is actually causing me a bit of pain. I know what is causing this problem which I will discuss below. I have spent only about an hour looking at the swfTools code and can't pin point exactly where the problem is in the code, but maybe someone else on this mailing list will know exactly where the problem is and know how to easily fix it.
The problem is the output SWF file is missing the FontBoundsTable in the DefineFont2 tag. The flash specification for flash 6 included this table that defines the area of each of the glyphs in the font table. However, this table was not used in the flash 6 player. So if you are output a flash 6 file there is no reason to include the bounds table. Flash 6 dynamically generates this bound information. However flash 9 (AVM2) works differently without this bounding table information the fonts will still display, but when you call getTextRunInfo() the returned object will be missing the corner information (i.e.corner0x). I can see in the code that the FontBoundsTable is being populated ( SWF_Font->layout->bounds ). But maybe it isn't being saved to the output file? I haven't managed to track down where the save routines are in the code yet. If anyone has any comments it would be greatly appreciated. Ken Sturgis > Re: [Swftools-common] Text Selection and other questions > Denis Zgonjanin > Thu, 14 Jan 2010 14:02:56 -0800 > Hi Filip, > > Thanks for the answers. I did try drawing shapes around the individual > characters, but have another problem. getTextRun() returns to me the x and y > position of the character, but height is returned as a decimal between 0 and > 1, which is odd because height is supposed to be in pixels. Also parameters > corner0x, corner0y, corner1x, corner1y, etc... are not there at all. The > documentation for getTextRun says that these will only be available if the > font is embedded in the SWF file. When I convert the file with pdf2swf I > include my entire fonts directory, yet even with simple fonts I don't seem > to be able to get these parameters. Do I have to explicitelly embed that > font in AS3 as well? If so, how do I know which fonts are in the pdf > originally? > > Thanks, > - Denis
