mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-19 04:54:06 +00:00
advances fix
This commit is contained in:
@@ -14,29 +14,35 @@ import java.util.List;
|
||||
public class IggyCharAdvances implements StructureInterface {
|
||||
|
||||
List<Float> advances;
|
||||
private long charCount;
|
||||
private List<IggyShape> glyphs;
|
||||
|
||||
public List<Float> getScales() {
|
||||
return advances;
|
||||
}
|
||||
|
||||
public IggyCharAdvances(ReadDataStreamInterface stream, long charCount) throws IOException {
|
||||
this.charCount = charCount;
|
||||
public IggyCharAdvances(ReadDataStreamInterface stream, List<IggyShape> glyphs) throws IOException {
|
||||
this.glyphs = glyphs;
|
||||
readFromDataStream(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromDataStream(ReadDataStreamInterface stream) throws IOException {
|
||||
advances = new ArrayList<>();
|
||||
for (int i = 0; i < charCount; i++) {
|
||||
advances.add(stream.readFloat());
|
||||
for (int i = 0; i < glyphs.size(); i++) {
|
||||
if (glyphs.get(i) != null) {
|
||||
advances.add(stream.readFloat());
|
||||
} else {
|
||||
advances.add(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToDataStream(WriteDataStreamInterface stream) throws IOException {
|
||||
for (int i = 0; i < advances.size(); i++) {
|
||||
stream.writeFloat(advances.get(i));
|
||||
if (advances.get(i) != null) {
|
||||
stream.writeFloat(advances.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ public class IggyFont extends IggyTag {
|
||||
}
|
||||
if (abs_start_of_scale != 0) {
|
||||
s.seek(abs_start_of_scale, SeekMode.SET);
|
||||
charScales = new IggyCharAdvances(s, char_count);
|
||||
charScales = new IggyCharAdvances(s, glyphs);
|
||||
}
|
||||
if (abs_start_of_kern != 0) {
|
||||
s.seek(abs_start_of_kern, SeekMode.SET);
|
||||
@@ -366,14 +366,15 @@ public class IggyFont extends IggyTag {
|
||||
s.writeUI64(0); //pad zero
|
||||
if (abs_start_of_char_struct != 0) {
|
||||
s.seek(abs_start_of_char_struct, SeekMode.SET);
|
||||
long baseOfsAddr = s.position();
|
||||
//offsets of shapes
|
||||
for (IggyCharOffset ofs : charOffsets) {
|
||||
ofs.writeToDataStream(s);
|
||||
}
|
||||
//long afterOfsAddr = s.position();
|
||||
for (int i = 0; i < glyphs.size(); i++) {
|
||||
IggyShape shp = glyphs.get(i);
|
||||
if (shp != null) {
|
||||
s.seek(charOffsets.get(i).getAddress(), SeekMode.SET);
|
||||
shp.writeToDataStream(s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,11 @@ public class IggySwf implements StructureInterface {
|
||||
newData = stream.getAllBytes();
|
||||
newLen = newData.length;
|
||||
}
|
||||
long oldLen = font_data_sizes[fontIndex];
|
||||
|
||||
//FIXME
|
||||
Helper.writeFile("d:\\Dropbox\\jpexs-laptop\\iggi\\extraxtdir_new\\font" + fontIndex + ".bin", newData);
|
||||
|
||||
/* long oldLen = font_data_sizes[fontIndex];
|
||||
long diff = newLen - oldLen;
|
||||
if (diff != 0) {
|
||||
font_data_sizes[fontIndex] = newLen;
|
||||
@@ -77,7 +81,7 @@ public class IggySwf implements StructureInterface {
|
||||
}
|
||||
}
|
||||
hdr.insertGapAfter(font_data_addresses[fontIndex], diff);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,7 +158,10 @@ public class IggySwf implements StructureInterface {
|
||||
fonts = new HashMap<>();
|
||||
for (int i = 0; i < hdr.font_count; i++) {
|
||||
s.seek(font_data_addresses[i], SeekMode.SET);
|
||||
//byte font_data[] = s.readBytes((int) font_data_sizes[i]);
|
||||
byte font_data[] = s.readBytes((int) font_data_sizes[i]);
|
||||
//FIXME
|
||||
Helper.writeFile("d:\\Dropbox\\jpexs-laptop\\iggi\\extraxtdir_orig\\font" + i + ".bin", font_data);
|
||||
s.seek(-font_data_sizes[i], SeekMode.CUR);
|
||||
IggyFont font = new IggyFont(s);
|
||||
fonts.put(i, font);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user