public override void Write(FileWriter writer, LayoutHeader header) { long pos = writer.Position - 8; base.Write(writer, header); writer.Write(TextLength); writer.Write(MaxTextLength); writer.Write(MaterialIndex); writer.Write(FontIndex); writer.Write(TextAlignment); writer.Write(LineAlignment, false); writer.Write(_flags); writer.Seek(1); long _ofsTextPos = writer.Position; writer.Write(0); //text offset writer.Write(FontTopColor.ToBytes()); writer.Write(FontBottomColor.ToBytes()); writer.Write(FontSize); writer.Write(CharacterSpace); writer.Write(LineSpace); if (Text != null) { Encoding encoding = Encoding.Unicode; if (writer.ByteOrder == Syroot.BinaryData.ByteOrder.BigEndian) { encoding = Encoding.BigEndianUnicode; } writer.WriteUint32Offset(_ofsTextPos, pos); if (RestrictedTextLengthEnabled) { writer.WriteString(Text, MaxTextLength, encoding); } else { writer.WriteString(Text, TextLength, encoding); } } }
public override void Write(FileWriter writer, LayoutHeader header) { long pos = writer.Position - 8; var textLength = TextLength; base.Write(writer, header); writer.Write(textLength); if (!RestrictedTextLengthEnabled) { writer.Write(textLength); } else { writer.Write(MaxTextLength); } writer.Write(MaterialIndex); writer.Write(FontIndex); writer.Write(TextAlignment); writer.Write(LineAlignment, false); writer.Write(_flags); writer.Seek(1); writer.Write(ItalicTilt); long _ofsTextPos = writer.Position; writer.Write(0); //text offset writer.Write(FontTopColor.ToBytes()); writer.Write(FontBottomColor.ToBytes()); writer.Write(FontSize); writer.Write(CharacterSpace); writer.Write(LineSpace); long _ofsNamePos = writer.Position; writer.Write(0); writer.Write(ShadowXY); writer.Write(ShadowXYSize); writer.Write(ShadowForeColor.ToBytes()); writer.Write(ShadowBackColor.ToBytes()); writer.Write(ShadowItalic); long _ofsPerCharTransform = writer.Position; if (header.VersionMajor > 2) { writer.Write(0); //per character transform offset } if (header.VersionMajor >= 8) { writer.Write(Unknown2); } if (Text != null) { Encoding encoding = Encoding.Unicode; if (writer.ByteOrder == Syroot.BinaryData.ByteOrder.BigEndian) { encoding = Encoding.BigEndianUnicode; } writer.WriteUint32Offset(_ofsTextPos, pos); if (RestrictedTextLengthEnabled) { writer.WriteString(Text, MaxTextLength, encoding); } else { writer.WriteString(Text, TextLength, encoding); } writer.Align(4); } if (TextBoxName != null) { writer.WriteUint32Offset(_ofsNamePos, pos); writer.WriteString(TextBoxName); writer.Align(4); } if (header.VersionMajor > 2 && PerCharTransformEnabled) { writer.WriteUint32Offset(_ofsPerCharTransform, pos); PerCharacterTransform.Write(writer, header); writer.Align(4); } }