/// <summary> /// Reade Header. /// </summary> /// <param name="reader">reader</param> /// <param name="formatType">TMPのフォーマットタイプ。</param> /// <returns>Header</returns> public static MieFontHeader Read(BinaryReader reader, MieFont.NFormatType formatType) { var result = new MieFontHeader(); result.GameObjectFileID = reader.ReadInt32(); result.GameObjectPathID = reader.ReadInt64(); result.GameObjectEnables = reader.ReadBoolean(); MieFont.ReadPadding(reader); result.ScriptFileID = reader.ReadInt32(); result.ScriptPathID = reader.ReadInt64(); result.FileName = MieFont.ReadString(reader); result.FileNameHashCode = reader.ReadInt32(); result.MaterialFileID = reader.ReadInt32(); result.MaterialPathID = reader.ReadInt64(); result.MaterialHashCode = reader.ReadInt32(); result.FontAssetType = reader.ReadInt32(); result.FontInfo = new MieFontInfo(formatType); result.FontInfo.Read(reader, formatType); result.AtlasFileID = reader.ReadInt32(); result.AtlasPathID = reader.ReadInt64(); return(result); }
public void Write(BinaryWriter writer, MieFont.NFormatType formatType) { MieFont.WriteString(writer, this.Name); writer.Write(this.PointSize); writer.Write(this.PointScale); writer.Write(this.CharacterCount); writer.Write(this.LineHeight); writer.Write(this.Baseline); writer.Write(this.Ascender); writer.Write(this.CapHeight); writer.Write(this.Descender); writer.Write(this.CenterLine); writer.Write(this.SuperScriptOffset); writer.Write(this.SubScriptOffset); writer.Write(this.SubSize); writer.Write(this.UnderlineUnderline); writer.Write(this.UnderlineUnderlineThickness); if (formatType != MieFont.NFormatType.PoE2) { //// オリジナルと自作フォントのレイアウトが会わない! //// 自作分はここに次のに項目が追加されている。 writer.Write(this.StrikeThrough); writer.Write(this.StrikeThroughThickness); } writer.Write(this.TabWidth); writer.Write(this.Padding); writer.Write(this.AtlasWidth); writer.Write(this.AtlasHeight); }
public void Read(BinaryReader reader, MieFont.NFormatType formatType) { this.Name = MieFont.ReadString(reader); this.PointSize = reader.ReadSingle(); this.PointScale = reader.ReadSingle(); this.CharacterCount = reader.ReadInt32(); this.LineHeight = reader.ReadSingle(); this.Baseline = reader.ReadSingle(); this.Ascender = reader.ReadSingle(); this.CapHeight = reader.ReadSingle(); this.Descender = reader.ReadSingle(); this.CenterLine = reader.ReadSingle(); this.SuperScriptOffset = reader.ReadSingle(); this.SubScriptOffset = reader.ReadSingle(); this.SubSize = reader.ReadSingle(); this.UnderlineUnderline = reader.ReadSingle(); this.UnderlineUnderlineThickness = reader.ReadSingle(); if (formatType != MieFont.NFormatType.PoE2) { //// オリジナルと自作フォントのレイアウトが会わない! //// 自作分はここに次のに項目が追加されている。 this.StrikeThrough = reader.ReadSingle(); this.StrikeThroughThickness = reader.ReadSingle(); } this.TabWidth = reader.ReadSingle(); this.Padding = reader.ReadSingle(); this.AtlasWidth = reader.ReadSingle(); this.AtlasHeight = reader.ReadSingle(); }
public void Write(BinaryWriter writer, MieFont.NFormatType formatType) { this.KerningTable.Write(writer); switch (formatType) { case MieFont.NFormatType.Unknown: break; case MieFont.NFormatType.Type1: break; case MieFont.NFormatType.Type2: //// 日本語データの構造 this.KerningPairBase.Write(writer); this.FontFallbackFontAssets.Write(writer); break; case MieFont.NFormatType.Type3: break; case MieFont.NFormatType.Type4: break; case MieFont.NFormatType.Type5: break; case MieFont.NFormatType.PoE2: //// オリジナルのデータ構造 this.KerningPairBase.Write(writer); writer.Write(this.LigaturesFileID); writer.Write(this.LigaturesPathID); writer.Write(this.InumStartAt); writer.Write(this.IsIlluminated); MieFont.WritePadding(writer); this.FontFallbackFontAssets.Write(writer); break; default: throw new Exception($"Unknown format type({formatType})"); } this.FontCreationSetting.Write(writer); this.FontWeights.Write(writer); writer.Write(this.NormalStyle); writer.Write(this.NormalSpaceingOffset); writer.Write(this.BoldStyle); writer.Write(this.BoldSpacing); writer.Write(this.ItalicStyle); writer.Write(this.TabSize); }
public void Write(BinaryWriter writer, MieFont.NFormatType formatType) { //// ToDo: ファイル名や内部名の長さを求める処理を追加。 writer.Write(this.GameObjectFileID); writer.Write(this.GameObjectPathID); writer.Write(this.GameObjectEnables); MieFont.WritePadding(writer); writer.Write(this.ScriptFileID); writer.Write(this.ScriptPathID); MieFont.WriteString(writer, this.FileName); writer.Write(this.FileNameHashCode); writer.Write(this.MaterialFileID); writer.Write(this.MaterialPathID); writer.Write(this.MaterialHashCode); writer.Write(this.FontAssetType); this.FontInfo.Write(writer, formatType); writer.Write(this.AtlasFileID); writer.Write(this.AtlasPathID); }
public static MieFontFooter Read(BinaryReader br, MieFont.NFormatType formatType) { MieFontFooter result = new MieFontFooter(); switch (formatType) { case MieFont.NFormatType.Unknown: break; case MieFont.NFormatType.Type1: break; case MieFont.NFormatType.Type2: //// 日本語データの構造 result.KerningTable = MieFontKerningTable.Read(br, MieFont.NFormatType.Type2); result.KerningPairBase = new MieFontKerningPairType2(); result.KerningPairBase.Read(br); result.FontFallbackFontAssets = MieFontFallbackFontAssets.Read(br); break; case MieFont.NFormatType.Type3: break; case MieFont.NFormatType.Type4: break; case MieFont.NFormatType.Type5: break; case MieFont.NFormatType.PoE2: //// オリジナルのデータ構造 result.KerningTable = MieFontKerningTable.Read(br, MieFont.NFormatType.PoE2); result.KerningPairBase = new MieFontKerningPairPoE2(); result.KerningPairBase.Read(br); result.LigaturesFileID = br.ReadInt32(); result.LigaturesPathID = br.ReadInt64(); result.InumStartAt = br.ReadInt32(); result.IsIlluminated = br.ReadBoolean(); MieFont.ReadPadding(br); result.FontFallbackFontAssets = MieFontFallbackFontAssets.Read(br); break; default: throw new Exception($"Unknown format type({formatType})."); } //// result.FontCreationSetting = MieFontCreationSetting.Read(br); //// result.FontWeights = MieFontWeights.Read(br); result.NormalStyle = br.ReadSingle(); result.NormalSpaceingOffset = br.ReadSingle(); result.BoldStyle = br.ReadSingle(); result.BoldSpacing = br.ReadSingle(); result.ItalicStyle = br.ReadInt32(); result.TabSize = br.ReadInt32(); return(result); }