JPEXS Free Flash Decompiler Issue Tracker

If you are looking for the decompiler itself, visit

: The issue tracker is now writable again and logged users can download files too. But note that our support is very LIMITED.

List of issuesList of issues

#1700 Get spaces correctly in text from GlyphEntries
Date created:
Type: question
Visibility: Everybody
Assigned to:
Labels: Text
State: opened Help

First off, thanks for this amazing software! I've been using the Java ffdec_lib library to read archives of old newspapers in SWF format and I got it working pretty good, except for a few things. Main problem is spaces in TextTags. Whenever I call getTexts(), I get a String with no spaces. I know that's the fault of the SWF format, where it just draws a character at an x, y position, and for spaces it just moves the x more to the right. So I'm trying to figure out for each glyph if the glphyAdvance is a space. I see methods in your code that look promising but I can't seem to get it to work. Main ones are StaticTextTag:getAdvance which calls FontTag:getSystemFontAdvance. I think that code gets the expected advance for the font, font style and fontsize and then if you subtract it from the glyphAdvance, you should be able to determine if there's a space or not after the character if the answer is >0. It kind of works but it's not very reliable. Is there code already in the library which already does this and I missed it? And if not, am I going down the right path of trying to figure out spaces in textrecords.
Hi, the regular spaces in text should be encoded as space character with its own glyph in Font tag, so the getTexts() method should return them as ' ' characters inside strings. At least in my test SWF (as2.swf) it does. But there are many ways how the text can be encoded so in you SWF the spaces may be as TEXTRECORD.xoffset or GLYPHENTRY.glyphAdvance. static method getAdvance tries to determine real advance without letterspacing. If the font "has layout", then the advance value is taken from the font parameters, otherwise it tries to get it from system font. If you subtract this value from GLYPHENTRY.glyphAdvance, you should get letterspacing or maybe in your case - a size of space. Unfortunately, there is not anything better than this in our library. So the answer is - yes, I think you are going the right way since I didn't not figure out anything better.
State: new→opened