diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ea286f7bc..b9f836e5f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Fixed +- [#2424] DefineEditText handling of letterSpacing, font size on incorrect values ## [22.0.2] - 2025-01-17 ### Added @@ -3688,6 +3690,7 @@ Major version of SWF to XML export changed to 2. [alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9 [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 +[#2424]: https://www.free-decompiler.com/flash/issues/2424 [#2375]: https://www.free-decompiler.com/flash/issues/2375 [#2374]: https://www.free-decompiler.com/flash/issues/2374 [#2389]: https://www.free-decompiler.com/flash/issues/2389 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 373fa65149..4454c2145d 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 @@ -450,20 +450,24 @@ public void startElement(String uri, String localName, String qName, Attributes } } String size = unescape(attributes.getValue("size")); - if (size != null && size.length() > 0) { - char firstChar = size.charAt(0); - if (firstChar != '+' && firstChar != '-') { - int fontSize = Integer.parseInt(size); - style.fontHeight = (int) Math.round(fontSize * SWF.unitDivisor); - } else { - int fontSizeDelta = (int) Math.round(Integer.parseInt(size.substring(1)) * SWF.unitDivisor); - if (firstChar == '+') { - style.fontHeight = style.fontHeight + fontSizeDelta; + if (size != null && size.length() > 0) { + try { + char firstChar = size.charAt(0); + if (firstChar != '+' && firstChar != '-') { + int fontSize = Integer.parseInt(size); + style.fontHeight = (int) Math.round(fontSize * SWF.unitDivisor); } else { - style.fontHeight = style.fontHeight - fontSizeDelta; + int fontSizeDelta = (int) Math.round(Integer.parseInt(size.substring(1)) * SWF.unitDivisor); + if (firstChar == '+') { + style.fontHeight = style.fontHeight + fontSizeDelta; + } else { + style.fontHeight = style.fontHeight - fontSizeDelta; + } } + style.fontLeading = leading; + } catch (NumberFormatException nfe) { + //do not change fontHeight or leading } - style.fontLeading = leading; } String face = unescape(attributes.getValue("face")); @@ -473,7 +477,11 @@ public void startElement(String uri, String localName, String qName, Attributes String letterspacing = unescape(attributes.getValue("letterSpacing")); if (letterspacing != null && letterspacing.length() > 0) { - style.letterSpacing = Double.parseDouble(letterspacing); + try { + style.letterSpacing = Double.parseDouble(letterspacing); + } catch (NumberFormatException nfe) { + //do not change letterSpacing + } } String kerning = unescape(attributes.getValue("kerning"));