mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-10 15:45:34 +00:00
#738 Frame export fails with EndOfStreamException: Premature end of the stream reached: fixed
This commit is contained in:
@@ -231,24 +231,26 @@ public class DefineFont2Tag extends FontTag {
|
||||
fontName = new String(sis.readBytesEx(fontNameLen, "fontName"));
|
||||
}
|
||||
numGlyphs = sis.readUI16("numGlyphs");
|
||||
//offsetTable = new long[numGlyphs];
|
||||
long[] offsetTable = new long[numGlyphs];
|
||||
long pos = sis.getPos();
|
||||
for (int i = 0; i < numGlyphs; i++) { //offsetTable
|
||||
if (fontFlagsWideOffsets) {
|
||||
sis.readUI32("offset");
|
||||
offsetTable[i] = sis.readUI32("offset");
|
||||
} else {
|
||||
sis.readUI16("offset");
|
||||
offsetTable[i] = sis.readUI16("offset");
|
||||
}
|
||||
}
|
||||
if (numGlyphs > 0) { //codeTableOffset
|
||||
if (fontFlagsWideOffsets) {
|
||||
sis.readUI32("offset");
|
||||
sis.readUI32("codeTableOffset");
|
||||
} else {
|
||||
sis.readUI16("offset");
|
||||
sis.readUI16("codeTableOffset");
|
||||
}
|
||||
}
|
||||
|
||||
glyphShapeTable = new ArrayList<>();
|
||||
for (int i = 0; i < numGlyphs; i++) {
|
||||
sis.seek(pos + offsetTable[i]);
|
||||
glyphShapeTable.add(sis.readSHAPE(1, false, "shape"));
|
||||
}
|
||||
|
||||
@@ -260,6 +262,7 @@ public class DefineFont2Tag extends FontTag {
|
||||
codeTable.add(sis.readUI8("code"));
|
||||
}
|
||||
}
|
||||
|
||||
if (fontFlagsHasLayout) {
|
||||
fontAscent = sis.readSI16("fontAscent");
|
||||
fontDescent = sis.readSI16("fontDescent");
|
||||
|
||||
@@ -144,22 +144,25 @@ public class DefineFont3Tag extends FontTag {
|
||||
fontName = new String(sis.readBytesEx(fontNameLen, "fontName"));
|
||||
}
|
||||
numGlyphs = sis.readUI16("numGlyphs");
|
||||
long[] offsetTable = new long[numGlyphs];
|
||||
long pos = sis.getPos();
|
||||
for (int i = 0; i < numGlyphs; i++) { //offsetTable
|
||||
if (fontFlagsWideOffsets) {
|
||||
sis.readUI32("offset");
|
||||
offsetTable[i] = sis.readUI32("offset");
|
||||
} else {
|
||||
sis.readUI16("offset");
|
||||
offsetTable[i] = sis.readUI16("offset");
|
||||
}
|
||||
}
|
||||
if (numGlyphs > 0) {
|
||||
if (fontFlagsWideOffsets) {
|
||||
sis.readUI32("offset"); //codeTableOffset
|
||||
sis.readUI32("codeTableOffset"); //codeTableOffset
|
||||
} else {
|
||||
sis.readUI16("offset"); //codeTableOffset
|
||||
sis.readUI16("codeTableOffset"); //codeTableOffset
|
||||
}
|
||||
}
|
||||
glyphShapeTable = new ArrayList<>();
|
||||
for (int i = 0; i < numGlyphs; i++) {
|
||||
sis.seek(pos + offsetTable[i]);
|
||||
glyphShapeTable.add(sis.readSHAPE(1, false, "shape"));
|
||||
}
|
||||
codeTable = new ArrayList<>();
|
||||
|
||||
@@ -160,13 +160,17 @@ public class DefineFontTag extends FontTag {
|
||||
glyphShapeTable = new ArrayList<>();
|
||||
|
||||
if (sis.available() > 0) {
|
||||
long pos = sis.getPos();
|
||||
int firstOffset = sis.readUI16("firstOffset");
|
||||
int nGlyphs = firstOffset / 2;
|
||||
|
||||
long[] offsetTable = new long[nGlyphs];
|
||||
offsetTable[0] = firstOffset;
|
||||
for (int i = 1; i < nGlyphs; i++) {
|
||||
sis.readUI16("offset"); //offset
|
||||
offsetTable[i] = sis.readUI16("offset");
|
||||
}
|
||||
for (int i = 0; i < nGlyphs; i++) {
|
||||
sis.seek(pos + offsetTable[i]);
|
||||
glyphShapeTable.add(sis.readSHAPE(1, false, "shape"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
|
||||
}
|
||||
if (rec.styleFlagsHasFont) {
|
||||
font = (FontTag) swf.characters.get(rec.fontId);
|
||||
glyphs = font.getGlyphShapeTable();
|
||||
glyphs = font == null ? null : font.getGlyphShapeTable();
|
||||
textHeight = rec.textHeight;
|
||||
}
|
||||
if (rec.styleFlagsHasXOffset) {
|
||||
@@ -306,7 +306,7 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
|
||||
Matrix matTr = Matrix.getTranslateInstance(x, y);
|
||||
mat = mat.concatenate(matTr);
|
||||
mat = mat.concatenate(Matrix.getScaleInstance(rat));
|
||||
if (entry.glyphIndex != -1) {
|
||||
if (entry.glyphIndex != -1 && glyphs != null) {
|
||||
// shapeNum: 1
|
||||
SHAPE shape = glyphs.get(entry.glyphIndex);
|
||||
BitmapExporter.export(swf, shape, textColor, image, mat, colorTransform);
|
||||
|
||||
@@ -143,7 +143,7 @@ public class Timeline {
|
||||
this.id = id;
|
||||
this.swf = swf;
|
||||
this.displayRect = displayRect;
|
||||
this.frameRate = swf.frameRate;
|
||||
this.frameRate = swf.frameRate < 1 ? 1 : swf.frameRate;
|
||||
this.timelined = parentTag == null ? swf : (Timelined) parentTag;
|
||||
this.parentTag = parentTag;
|
||||
this.tags = tags;
|
||||
|
||||
Reference in New Issue
Block a user