fix: correct handling hasFontClass text attribute (#2692)

Fixes #2692
This commit is contained in:
Jindra Petřík
2026-04-07 09:19:56 +02:00
parent 6c6daf37eb
commit 74b70dcfcb
3 changed files with 6 additions and 6 deletions

View File

@@ -390,7 +390,7 @@ public class FontNormalizer {
private Set<Integer> getDefineEditTextFonts(DefineEditTextTag text) {
Set<Integer> ret = new LinkedHashSet<>();
TextStyle style = new TextStyle();
if (text.fontClass != null) {
if (text.hasFontClass) {
style.font = text.getSwf().getFontByClass(text.fontClass);
} else {
style.font = text.getSwf().getFont(text.fontId);
@@ -513,7 +513,7 @@ public class FontNormalizer {
private void scaleDefineEditTextFonts(DefineEditTextTag text, Map<Integer, Double> fontNewScale, boolean inPlace, Map<Integer, TextTag> outTexts) {
String str = "";
TextStyle style = new TextStyle();
if (text.fontClass != null) {
if (text.hasFontClass) {
style.font = text.getSwf().getFontByClass(text.fontClass);
} else {
style.font = text.getSwf().getFont(text.fontId);

View File

@@ -402,7 +402,7 @@ public class XamlExporter {
int fontId = defineEditText.fontId;
FontTag font = null;
if (fontId == -1) {
if (defineEditText.fontClass != null) {
if (defineEditText.hasFontClass) {
font = swf.getFontByClass(defineEditText.fontClass);
fontId = swf.getCharacterId(font);
}

View File

@@ -538,7 +538,7 @@ public class DefineEditTextTag extends TextTag {
}
String str = "";
TextStyle style = new TextStyle();
if (fontClass != null) {
if (hasFontClass) {
style.font = swf.getFontByClass(fontClass);
} else {
style.font = swf.getFont(fontId);
@@ -1607,8 +1607,8 @@ public class DefineEditTextTag extends TextTag {
for (SameStyleTextRecord tr : line) {
AdvancedTextRecord tr2 = new AdvancedTextRecord();
int fid = fontId;
if (fontClass != null) {
tr2.fontClass = fontClass;
if (hasFontClass) {
tr2.fontClass = fontClass; //FIXME?
}
if (tr.style.font != null) {
fid = swf.getCharacterId(tr.style.font);