Issue #702 GFX font reading fixed

This commit is contained in:
Jindra Petřík
2014-10-22 16:28:06 +02:00
parent e5f687c8ea
commit 7a8dffa5ab
4 changed files with 20 additions and 14 deletions

View File

@@ -149,7 +149,7 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag {
FontType font = fonts.get(0);
double d = 1; //1024/font.nominalSize;
SHAPE shp = SHAPERECORD.fontCharacterToSHAPE(cfont, fontStyle, (int) (SWF.unitDivisor * font.nominalSize * d), character);
SHAPE shp = SHAPERECORD.fontCharacterToSHAPE(cfont, fontStyle, (int) (font.nominalSize * d), character);
int code = (int) character;
int pos = -1;

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.types.gfx;
import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
@@ -38,7 +39,7 @@ public class ContourType implements Serializable {
public ContourType(List<SHAPERECORD> records) {
int i = 0;
int i = 0;
int divider = 1;
for (; i < records.size(); i++) {
if (records.get(i) instanceof StyleChangeRecord) {
StyleChangeRecord scr = (StyleChangeRecord) records.get(i);
@@ -69,20 +70,23 @@ public class ContourType implements Serializable {
edges = edgesList.toArray(new EdgeType[edgesList.size()]);
}
public ContourType(GFxInputStream sis,long fontOffset) throws IOException {
moveToX = sis.readSI15("moveToX");
moveToY = sis.readSI15("moveToY");
long numEdgesRef = sis.readUI30("numEdgesRef");
isReference = (numEdgesRef & 1) == 1;
numEdgesRef >>= 1;
long oldPos = sis.getPos();
int numEdges;
if (isReference) {
if (isReference) {
sis.setPos(numEdgesRef);
numEdgesRef = sis.readUI30("numEdgesRef");
long referencePos = numEdgesRef;
sis.setPos(fontOffset+referencePos);
numEdges = (int)(sis.readUI30("numEdges") >> 1);
}else{
numEdges = (int)numEdgesRef;
}
edges = new EdgeType[(int) numEdges];
for (int i = 0; i < edges.length; i++) {
sis.newDumpLevel("edgeType", "EdgeType");
edges[i] = new EdgeType(sis);

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.types.gfx;
import com.jpexs.decompiler.flash.types.SHAPE;
@@ -73,10 +74,10 @@ public class FontType implements Serializable {
for (int i = 0; i < glyphInfo.size(); i++) {
sis.setPos(glyphInfo.get(i).globalOffset + offset);
sis.newDumpLevel("glyphType", "GlyphType");
sis.newDumpLevel("glyphType", "GlyphType");
glyphs.add(new GlyphType(sis,offset));
sis.endDumpLevel();
}
}
sis.setPos(pos);
}

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.types.gfx;
import com.jpexs.decompiler.flash.types.RECT;
@@ -60,7 +61,7 @@ public class GlyphType implements Serializable {
contours = contoursList.toArray(new ContourType[contoursList.size()]);
}
public GlyphType(GFxInputStream sis, long fontOffset) throws IOException {
boundingBox = new int[4];
for (int i = 0; i < 4; i++) {
boundingBox[i] = sis.readSI15("boundingBox");
@@ -69,7 +70,7 @@ public class GlyphType implements Serializable {
contours = new ContourType[numContours];
for (int i = 0; i < numContours; i++) {
sis.newDumpLevel("contourType", "ContourType");
sis.newDumpLevel("contourType", "ContourType");
contours[i] = new ContourType(sis, fontOffset);
sis.endDumpLevel();
}
}