character adding problem fixed

This commit is contained in:
honfika@gmail.com
2014-11-30 20:29:02 +01:00
parent 131fb23dff
commit 80874e4d22
3 changed files with 29 additions and 22 deletions

View File

@@ -343,6 +343,19 @@ public class DefineText2Tag extends TextTag {
if (font == null) {
throw new TextParseException("Font not defined", lexer.yyline());
}
for (int i = 0; i < txt.length(); i++) {
char c = txt.charAt(i);
if (!font.containsChar(c)) {
if (!missingCharHandler.handle(font, c)) {
return false;
}
return setFormattedText(missingCharHandler, formattedText, texts);
}
}
TEXTRECORD tr = new TEXTRECORD();
textRecords.add(tr);
if (fontId > -1) {
@@ -374,16 +387,6 @@ public class DefineText2Tag extends TextTag {
nextChar = txt.charAt(i + 1);
}
if (!font.containsChar(c)) {
if (!missingCharHandler.handle(font, c)) {
return false;
}
}
if (nextChar != null && !font.containsChar(nextChar)) {
if (!missingCharHandler.handle(font, nextChar)) {
return false;
}
}
tr.glyphEntries[i] = new GLYPHENTRY();
tr.glyphEntries[i].glyphIndex = font.charToGlyph(c);
@@ -410,7 +413,6 @@ public class DefineText2Tag extends TextTag {
}
break;
}
}
setModified(true);

View File

@@ -349,6 +349,19 @@ public class DefineTextTag extends TextTag {
if (font == null) {
throw new TextParseException("Font not defined", lexer.yyline());
}
for (int i = 0; i < txt.length(); i++) {
char c = txt.charAt(i);
if (!font.containsChar(c)) {
if (!missingCharHandler.handle(font, c)) {
return false;
}
return setFormattedText(missingCharHandler, formattedText, texts);
}
}
TEXTRECORD tr = new TEXTRECORD();
textRecords.add(tr);
if (fontId > -1) {
@@ -380,16 +393,6 @@ public class DefineTextTag extends TextTag {
nextChar = txt.charAt(i + 1);
}
if (!font.containsChar(c)) {
if (!missingCharHandler.handle(font, c)) {
return false;
}
}
if (nextChar != null && !font.containsChar(nextChar)) {
if (!missingCharHandler.handle(font, nextChar)) {
return false;
}
}
tr.glyphEntries[i] = new GLYPHENTRY();
tr.glyphEntries[i].glyphIndex = font.charToGlyph(c);

View File

@@ -182,7 +182,7 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
return defaultFontName;
}
public void shiftGlyphIndices(int fontId, int startIndex) {
protected void shiftGlyphIndices(int fontId, int startIndex) {
for (Tag t : swf.tags) {
List<TEXTRECORD> textRecords = null;
if (t instanceof DefineTextTag) {
@@ -197,9 +197,11 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
if (tr.styleFlagsHasFont) {
curFontId = tr.fontId;
}
if (curFontId != fontId) {
continue;
}
for (GLYPHENTRY en : tr.glyphEntries) {
if (en == null) { //Currently edited
continue;