diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java index e2d334433..bad80f4f1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont2Tag.java @@ -99,7 +99,10 @@ public class DefineFont2Tag extends FontTag { @Override public RECT getGlyphBounds(int glyphIndex) { - return fontBoundsTable.get(glyphIndex); + if (fontFlagsHasLayout) { + return fontBoundsTable.get(glyphIndex); + } + return super.getGlyphBounds(glyphIndex); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java index 58c61d453..25d8a52ea 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineFont3Tag.java @@ -472,7 +472,10 @@ public class DefineFont3Tag extends FontTag { @Override public RECT getGlyphBounds(int glyphIndex) { - return fontBoundsTable.get(glyphIndex); + if (fontFlagsHasLayout) { + return fontBoundsTable.get(glyphIndex); + } + return super.getGlyphBounds(glyphIndex); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index 60387642b..7da058217 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -316,6 +316,13 @@ public abstract class TextTag extends CharacterTag implements DrawableTag { // shapeNum: 1 SHAPE shape = glyphs.get(entry.glyphIndex); BitmapExporter.export(swf, shape, textColor2, image, mat, colorTransform); + if (SHAPERECORD.DRAW_BOUNDING_BOX){ + RGB borderColor = new RGBA(Color.black); + RGB fillColor = new RGBA(new Color(255, 255, 255, 0)); + RECT bounds = shape.getBounds(); + mat = Matrix.getTranslateInstance(bounds.Xmin, bounds.Ymin).preConcatenate(mat); + TextTag.drawBorder(swf, image, borderColor, fillColor, bounds, new MATRIX(), mat, colorTransform); + } x += entry.glyphAdvance; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java index eb5f1ac49..dca9aeb3b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/shaperecords/SHAPERECORD.java @@ -50,7 +50,7 @@ import java.util.Set; public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Serializable { public static final int MAX_CHARACTERS_IN_FONT_PREVIEW = 400; - private static final boolean DRAW_BOUNDING_BOX = false; + public static final boolean DRAW_BOUNDING_BOX = false; public abstract void calculateBits(); @@ -78,25 +78,6 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali int min_y = Integer.MAX_VALUE; boolean started = false; for (SHAPERECORD r : records) { - x = r.changeX(x); - y = r.changeY(y); - if (x > max_x) { - max_x = x; - } - if (y > max_y) { - max_y = y; - } - if (r.isMove()) { - started = true; - } - if (started) { - if (y < min_y) { - min_y = y; - } - if (x < min_x) { - min_x = x; - } - } if (r instanceof CurvedEdgeRecord) { CurvedEdgeRecord curverEdge = (CurvedEdgeRecord) r; int x2 = x + curverEdge.controlDeltaX; @@ -116,6 +97,26 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali } } } + + x = r.changeX(x); + y = r.changeY(y); + if (x > max_x) { + max_x = x; + } + if (y > max_y) { + max_y = y; + } + if (r.isMove()) { + started = true; + } + if (started) { + if (y < min_y) { + min_y = y; + } + if (x < min_x) { + min_x = x; + } + } } return new RECT(min_x, max_x, min_y, max_y); }