mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-28 19:35:30 +00:00
SWFOutputStream correct charset handling when saving NetString (font names)
This commit is contained in:
@@ -198,23 +198,10 @@ public class SWFOutputStream extends OutputStream {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeNetString(String value) throws IOException {
|
||||
byte[] data = value.getBytes();
|
||||
writeUI8(data.length);
|
||||
write(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes netstring (length + string) value to the stream
|
||||
*
|
||||
* @param value String value
|
||||
* @param charset
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeNetString(String value, Charset charset) throws IOException {
|
||||
byte[] data = value.getBytes(charset);
|
||||
writeUI8(data.length);
|
||||
write(data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes UI32 (Unsigned 32bit integer) value to the stream
|
||||
|
||||
@@ -256,11 +256,7 @@ public class DefineFont2Tag extends FontTag {
|
||||
sos.writeUB(1, fontFlagsItalic ? 1 : 0);
|
||||
sos.writeUB(1, fontFlagsBold ? 1 : 0);
|
||||
sos.writeLANGCODE(languageCode);
|
||||
if (swf.version >= 6) {
|
||||
sos.writeNetString(fontName, Utf8Helper.charset);
|
||||
} else {
|
||||
sos.writeNetString(fontName);
|
||||
}
|
||||
sos.writeNetString(fontName);
|
||||
int numGlyphs = glyphShapeTable.size();
|
||||
sos.writeUI16(numGlyphs);
|
||||
|
||||
|
||||
@@ -253,11 +253,7 @@ public class DefineFont3Tag extends FontTag {
|
||||
sos.writeUB(1, fontFlagsItalic ? 1 : 0);
|
||||
sos.writeUB(1, fontFlagsBold ? 1 : 0);
|
||||
sos.writeLANGCODE(languageCode);
|
||||
if (swf.version >= 6) {
|
||||
sos.writeNetString(fontName, Utf8Helper.charset);
|
||||
} else {
|
||||
sos.writeNetString(fontName);
|
||||
}
|
||||
sos.writeNetString(fontName);
|
||||
sos.writeUI16(numGlyphs);
|
||||
|
||||
for (long offset : offsetTable) {
|
||||
|
||||
@@ -118,11 +118,7 @@ public class DefineFontInfo2Tag extends FontInfoTag {
|
||||
@Override
|
||||
public void getData(SWFOutputStream sos) throws IOException {
|
||||
sos.writeUI16(fontID);
|
||||
if (swf.version >= 6) {
|
||||
sos.writeNetString(fontName, Utf8Helper.charset);
|
||||
} else {
|
||||
sos.writeNetString(fontName);
|
||||
}
|
||||
sos.writeNetString(fontName);
|
||||
sos.writeUB(2, reserved);
|
||||
sos.writeUB(1, fontFlagsSmallText ? 1 : 0);
|
||||
sos.writeUB(1, fontFlagsShiftJIS ? 1 : 0);
|
||||
|
||||
@@ -116,11 +116,7 @@ public class DefineFontInfoTag extends FontInfoTag {
|
||||
@Override
|
||||
public void getData(SWFOutputStream sos) throws IOException {
|
||||
sos.writeUI16(fontID);
|
||||
if (swf.version >= 6) {
|
||||
sos.writeNetString(fontName, Utf8Helper.charset);
|
||||
} else {
|
||||
sos.writeNetString(fontName);
|
||||
}
|
||||
sos.writeNetString(fontName);
|
||||
sos.writeUB(2, reserved);
|
||||
sos.writeUB(1, fontFlagsSmallText ? 1 : 0);
|
||||
sos.writeUB(1, fontFlagsShiftJIS ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user