diff --git a/CHANGELOG.md b/CHANGELOG.md index c00966192..5d04a6e15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. - [#1687] Slow speed of cyclic tags detection - CopyStream bug for copies smaller than the buffer size - [#1748] Wrong matching of DefineEditText fonts for rendering +- [#1748] Line height - Descent/ascent in multiline DefineEditText - Editation of font descent colliding with leading ## [14.4.0] - 2021-04-05 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 8841b6988..dbef29f39 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -1123,7 +1123,8 @@ public class DefineEditTextTag extends TextTag { List allTextRecords = new ArrayList<>(); int lastHeight = 0; - int yOffset = -leading; + int yOffset = 0; + boolean firstLine = true; for (List line : lines) { int width = 0; int currentOffset = 0; @@ -1132,13 +1133,17 @@ public class DefineEditTextTag extends TextTag { } else { for (SameStyleTextRecord tr : line) { width += tr.width; - int lineHeight = tr.style.fontHeight + tr.style.fontLeading; + int lineHeight = (int) Math.round(tr.style.fontHeight * tr.style.font.getAscent() / tr.style.font.getDivider() / 1024.0) + tr.style.fontLeading; + if (tr.style.font != null && !firstLine) { + lineHeight += (int) Math.round(tr.style.fontHeight * tr.style.font.getDescent() / tr.style.font.getDivider() / 1024.0); + } lastHeight = lineHeight; if (lineHeight > currentOffset) { currentOffset = lineHeight; } } } + firstLine = false; yOffset += currentOffset; int alignOffset = 0; switch (align) { diff --git a/libsrc/ffdec_lib/testdata/graphics/graphics.swf b/libsrc/ffdec_lib/testdata/graphics/graphics.swf index f878a0d97..84fdc6de2 100644 Binary files a/libsrc/ffdec_lib/testdata/graphics/graphics.swf and b/libsrc/ffdec_lib/testdata/graphics/graphics.swf differ diff --git a/libsrc/ffdec_lib/testdata/graphics/graphics/DOMDocument.xml b/libsrc/ffdec_lib/testdata/graphics/graphics/DOMDocument.xml index 42a4a6514..cde07d9fa 100644 --- a/libsrc/ffdec_lib/testdata/graphics/graphics/DOMDocument.xml +++ b/libsrc/ffdec_lib/testdata/graphics/graphics/DOMDocument.xml @@ -1,7 +1,7 @@ - + - + @@ -39,7 +39,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -75,6 +75,33 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -249,10 +276,10 @@ - + @@ -781,10 +808,10 @@ !3980 1990|2980 1990!2980 1990|2980 990!2980 990|3980 990!3980 990|3980 1990"/> - + @@ -1383,18 +1410,18 @@ - + - - + + @@ -1416,12 +1443,12 @@ - + - + @@ -1429,7 +1456,7 @@ - + @@ -1442,7 +1469,7 @@ - + @@ -2150,7 +2177,52 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + First Second Third + + + + + + + @@ -2779,7 +2851,7 @@ - + @@ -3527,14 +3599,23 @@ - + + + + + - + - - - - + + + 063 Multiline text + + + + + + @@ -3544,6 +3625,10 @@ + + + + @@ -3560,9 +3645,5 @@ - - - - \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/ScaledRect.xml b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/ScaledRect.xml index b79e532f5..31711240e 100644 --- a/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/ScaledRect.xml +++ b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/ScaledRect.xml @@ -28,125 +28,92 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/Sprite1.xml b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/Sprite1.xml index 21fc928b6..e775eccfa 100644 --- a/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/Sprite1.xml +++ b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/Sprite1.xml @@ -25,9 +25,9 @@ - - + + diff --git a/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/ThreePinkDots.xml b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/ThreePinkDots.xml new file mode 100644 index 000000000..79d03de6f --- /dev/null +++ b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/ThreePinkDots.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/dotssprite.xml b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/dotssprite.xml new file mode 100644 index 000000000..c4f74a1a4 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/dotssprite.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/grid.xml b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/grid.xml index 97303d54f..9f75c9519 100644 --- a/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/grid.xml +++ b/libsrc/ffdec_lib/testdata/graphics/graphics/LIBRARY/grid.xml @@ -29,70 +29,72 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libsrc/ffdec_lib/testdata/graphics/graphics/META-INF/metadata.xml b/libsrc/ffdec_lib/testdata/graphics/graphics/META-INF/metadata.xml index e22df05fa..e384bea8c 100644 --- a/libsrc/ffdec_lib/testdata/graphics/graphics/META-INF/metadata.xml +++ b/libsrc/ffdec_lib/testdata/graphics/graphics/META-INF/metadata.xml @@ -5,8 +5,8 @@ xmlns:xmp="http://ns.adobe.com/xap/1.0/"> Adobe Flash Professional CS6 - build 481 2021-03-14T08:29:20+01:00 - 2021-04-02T15:02:59+02:00 - 2021-04-02T15:02:59+02:00 + 2021-11-17T11:15:56-08:00 + 2021-11-17T11:15:56-08:00 @@ -15,7 +15,7 @@ - xmp.iid:E3E40BC0B393EB11B4038A481A0499E8 + xmp.iid:89B07B0DDA47EC11A869CDC6AA3E2CFC xmp.did:D6D3FE199784EB1187FEAE6972EC5115 xmp.did:D6D3FE199784EB1187FEAE6972EC5115 @@ -116,6 +116,12 @@ 2021-03-14T08:29:20+01:00 Adobe Flash Professional CS6 - build 481 + + created + xmp.iid:89B07B0DDA47EC11A869CDC6AA3E2CFC + 2021-03-14T08:29:20+01:00 + Adobe Flash Professional CS6 - build 481 + diff --git a/libsrc/ffdec_lib/testdata/graphics/graphics/bin/SymDepend.cache b/libsrc/ffdec_lib/testdata/graphics/graphics/bin/SymDepend.cache index 3c3ff0412..ebf0d6d13 100644 Binary files a/libsrc/ffdec_lib/testdata/graphics/graphics/bin/SymDepend.cache and b/libsrc/ffdec_lib/testdata/graphics/graphics/bin/SymDepend.cache differ