From 35b0cebdd6954620e5d310bef05d33bb9a78343d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 23 Jun 2025 21:13:31 +0200 Subject: [PATCH] Not using font glyph advance for last glyph in text. --- .../jpexs/decompiler/flash/tags/base/TextTag.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 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 a3dfc3109..eecca199a 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 @@ -858,7 +858,8 @@ public abstract class TextTag extends DrawableTag { int x = 0; int y = 0; List glyphs = new ArrayList<>(); - for (TEXTRECORD rec : textRecords) { + for (int r = 0; r < textRecords.size(); r++) { + TEXTRECORD rec = textRecords.get(r); if (rec.styleFlagsHasColor) { if (numText == 2) { textColor = rec.textColorA.toInt(); @@ -892,16 +893,11 @@ public abstract class TextTag extends DrawableTag { if (exporter.useTextTag) { StringBuilder text = new StringBuilder(); int totalAdvance = 0; - for (int i = 0; i < rec.glyphEntries.size(); i++) { - GLYPHENTRY entry = rec.glyphEntries.get(i); + for (GLYPHENTRY entry : rec.glyphEntries) { if (entry.glyphIndex != -1) { char ch = font.glyphToChar(entry.glyphIndex); text.append(ch); - if (i == rec.glyphEntries.size() - 1 && entry.glyphAdvance == 0) { - totalAdvance += font.getGlyphAdvance(entry.glyphIndex) * rat; - } else { - totalAdvance += entry.glyphAdvance; - } + totalAdvance += entry.glyphAdvance; } }