From 53725fbb0ec1e92dd3fd519f7f475a2287571c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 31 Aug 2025 00:47:44 +0200 Subject: [PATCH] Ignore missing font --- .../decompiler/flash/tags/base/TextTag.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) 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 c595c425d..5ce4749d4 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 @@ -709,25 +709,27 @@ public abstract class TextTag extends DrawableTag { textHeight = rec.textHeight; - if (!font.hasLayout()) { - String fontName = FontTag.getFontNameWithFallback(font.getFontNameIntag()); - Font aFont = new Font(fontName, font.getFontStyle(), (int) (textHeight / SWF.unitDivisor)); + if (font != null) { + if (!font.hasLayout()) { + String fontName = FontTag.getFontNameWithFallback(font.getFontNameIntag()); + Font aFont = new Font(fontName, font.getFontStyle(), (int) (textHeight / SWF.unitDivisor)); - Map attr = new HashMap<>(); + Map attr = new HashMap<>(); - attr.put(TextAttribute.KERNING, TextAttribute.KERNING_ON); - attr.put(TextAttribute.LIGATURES, TextAttribute.LIGATURES_ON); - aFont = aFont.deriveFont(attr); + attr.put(TextAttribute.KERNING, TextAttribute.KERNING_ON); + attr.put(TextAttribute.LIGATURES, TextAttribute.LIGATURES_ON); + aFont = aFont.deriveFont(attr); - fontMetrics = graphics.getFontMetrics(aFont); - LineMetrics lm = fontMetrics.getLineMetrics("A", graphics); - ascent = lm.getAscent() * 1024 * font.getDivider() / (textHeight / SWF.unitDivisor); - descent = lm.getDescent() * 1024 * font.getDivider() / (textHeight / SWF.unitDivisor); - leading = lm.getLeading() * 1024 * font.getDivider() / (textHeight / SWF.unitDivisor); - } else { - ascent = font.getAscent(); //((double) font.getAscent() * textHeight / 1024.0 / font.getDivider()); - descent = font.getDescent(); //(double) font.getDescent() * textHeight / 1024.0 / font.getDivider()); - leading = font.getLeading(); //(double) font.getLeading()* textHeight / 1024.0 / font.getDivider()); + fontMetrics = graphics.getFontMetrics(aFont); + LineMetrics lm = fontMetrics.getLineMetrics("A", graphics); + ascent = lm.getAscent() * 1024 * font.getDivider() / (textHeight / SWF.unitDivisor); + descent = lm.getDescent() * 1024 * font.getDivider() / (textHeight / SWF.unitDivisor); + leading = lm.getLeading() * 1024 * font.getDivider() / (textHeight / SWF.unitDivisor); + } else { + ascent = font.getAscent(); //((double) font.getAscent() * textHeight / 1024.0 / font.getDivider()); + descent = font.getDescent(); //(double) font.getDescent() * textHeight / 1024.0 / font.getDivider()); + leading = font.getLeading(); //(double) font.getLeading()* textHeight / 1024.0 / font.getDivider()); + } } } if (rec.styleFlagsHasXOffset) {