#284 fixed nullpointer exceptions, texttag

This commit is contained in:
Jindra Petk
2013-08-01 19:05:17 +02:00
parent 5697a248cc
commit 3fdfaa5b56
4 changed files with 21 additions and 3 deletions

View File

@@ -47,6 +47,9 @@ public class NotCompileTimeAVM2Item extends AVM2Item {
@Override
public GraphTargetItem getThroughNotCompilable() {
if(object==null){
return object;
}
return object.getThroughNotCompilable();
}
}

View File

@@ -1337,6 +1337,13 @@ public class Action implements GraphSourceItem {
if (o instanceof Long) {
return (Long) o;
}
if(o instanceof String){
try{
return Double.parseDouble((String)o);
}catch(NumberFormatException nfe){
return 0;
}
}
return 0;
}

View File

@@ -128,7 +128,9 @@ public class DefineSpriteTag extends CharacterTag implements Container, BoundedT
depthMap.put(pot.getDepth(), charId);
characterId = (charId);
} else {
characterId = (depthMap.get(pot.getDepth()));
Integer chi= (depthMap.get(pot.getDepth()));
if(chi!=null)
characterId = chi;
}
}
if (characterId == -1) {

View File

@@ -118,7 +118,7 @@ public abstract class TextTag extends CharacterTag implements BoundedTag {
textHeight = rec.textHeight;
glyphs = font.getGlyphShapeTable();
if (font.getLeading() == -1) {
if (!font.hasLayout()) {
String fontName = font.getFontName(tags);
if (!availableFonts.contains(fontName)) {
fontName = "Times New Roman";
@@ -175,7 +175,13 @@ public abstract class TextTag extends CharacterTag implements BoundedTag {
updateRect(textBounds, x + rect.Xmin, y + rect.Ymin);
updateRect(textBounds, x + rect.Xmax, y + rect.Ymax);
int adv = entry.glyphAdvance;
int defaultAdvance = 20 * FontTag.getSystemFontAdvance(aFont, font.glyphToChar(tags, entry.glyphIndex));
int defaultAdvance;
if (font.hasLayout()) {
defaultAdvance = 20 * (int) Math.round((double) textHeight * font.getGlyphAdvance(entry.glyphIndex) / (font.getDivider() * 1024.0));
} else {
defaultAdvance = 20 * FontTag.getSystemFontAdvance(aFont, font.glyphToChar(tags, entry.glyphIndex));
}
letterSpacing = adv - defaultAdvance;
x += adv;
}