/// <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 Convert( MieFontHeader jp, MieFont.NFormatType formatType, bool forceAdjustAscender) { ////this.GameObjectFileID = jp.GameObjectFileID; ////this.GameObjectPathID = jp.GameObjectPathID; ////this.GameObjectEnables = jp.GameObjectEnables; ////this.ScriptFileID = jp.ScriptFileID; ////this.ScriptPathID = jp.ScriptPathID; ////this.FileNameLength = jp.FileNameLength; ////this.FileName = jp.FileName; ////this.FileNameHashCode = jp.FileNameHashCode; ////this.MaterialFileID = jp.MaterialFileID; ////this.MaterialPathID = jp.MaterialPathID; ////this.MaterialHashCode = jp.MaterialHashCode; ////this.FontAssetType = jp.FontAssetType; ////this.LengthOfFontName = jp.LengthOfFontName; ////this.InternalFileName = jp.InternalFileName; this.FontInfo.Convert(jp.FontInfo, formatType, forceAdjustAscender); ////this.AtlasFileID = jp.AtlasFileID; ////this.AtlasPathID = jp.AtlasPathID; }
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 static MieFontKerningTable Read(BinaryReader br, MieFont.NFormatType type) { var kerningTable = new MieFontKerningTable(); var count = br.ReadInt32(); for (var i = 0; i < count; i++) { switch (type) { case MieFont.NFormatType.Unknown: throw new NotImplementedException(); case MieFont.NFormatType.Type1: throw new NotImplementedException(); case MieFont.NFormatType.Type2: var kerningPair2 = new MieFontKerningPairType2(); kerningPair2.Read(br); kerningTable.Items.Add(kerningPair2); break; case MieFont.NFormatType.Type3: throw new NotImplementedException(); case MieFont.NFormatType.Type4: throw new NotImplementedException(); case MieFont.NFormatType.Type5: throw new NotImplementedException(); case MieFont.NFormatType.PoE2: var kerningPair1 = new MieFontKerningPairType1(); kerningPair1.Read(br); kerningTable.Items.Add(kerningPair1); break; default: throw new Exception($"Unknown Format type({type})"); } } return(kerningTable); }
public void Convert( MieFontInfo jpFontInfo, MieFont.NFormatType formatType, bool forceAdjustAscender) { ////this.Name = jpFontInfo.Name; this.PointSize = jpFontInfo.PointSize; this.PointScale = jpFontInfo.PointScale; this.CharacterCount = jpFontInfo.CharacterCount; this.LineHeight = jpFontInfo.LineHeight; //// フォント・ボディの高さ this.Baseline = jpFontInfo.Baseline; if (forceAdjustAscender) { //// Ascenderの値を強制的に調整する。 //// Ascenderの値をPointSizeにする。 this.Ascender = jpFontInfo.PointSize; } else { //// フォントの設定値をそのまま利用する。 this.Ascender = jpFontInfo.Ascender; } this.CapHeight = jpFontInfo.CapHeight; this.Descender = jpFontInfo.Descender; this.CenterLine = jpFontInfo.CenterLine; this.SuperScriptOffset = jpFontInfo.SuperScriptOffset; this.SubScriptOffset = jpFontInfo.SubScriptOffset; this.SubSize = jpFontInfo.SubSize; if (formatType == MieFont.NFormatType.PoE2) { //// オリジナルと自作フォントのレイアウトが会わない! //// 自作分はここに次のに項目が追加されている。 this.StrikeThrough = jpFontInfo.StrikeThrough; this.StrikeThroughThickness = jpFontInfo.StrikeThroughThickness; } this.UnderlineUnderline = jpFontInfo.UnderlineUnderline; this.UnderlineUnderlineThickness = jpFontInfo.UnderlineUnderlineThickness; this.TabWidth = jpFontInfo.TabWidth; this.Padding = jpFontInfo.Padding; this.AtlasWidth = jpFontInfo.AtlasWidth; this.AtlasHeight = jpFontInfo.AtlasHeight; }
public void Convert(MieFontFooter jp, MieFont.NFormatType formatType) { switch (formatType) { case MieFont.NFormatType.Unknown: throw new NotImplementedException(); case MieFont.NFormatType.Type1: throw new NotImplementedException(); case MieFont.NFormatType.Type2: //// 日本語データの構造 //// 元データをそのまま使用するため、処理なし。 break; case MieFont.NFormatType.Type3: throw new NotImplementedException(); case MieFont.NFormatType.Type4: throw new NotImplementedException(); case MieFont.NFormatType.Type5: throw new NotImplementedException(); case MieFont.NFormatType.PoE2: //// オリジナルのデータ構造 throw new NotImplementedException(); default: throw new Exception($"Unknown format type({formatType})"); } //// this.FontWeights.Convert(jp.FontWeights); this.NormalStyle = jp.NormalStyle; this.NormalSpaceingOffset = jp.NormalSpaceingOffset; this.BoldStyle = jp.BoldStyle; this.BoldSpacing = jp.BoldSpacing; this.ItalicStyle = jp.ItalicStyle; this.TabSize = jp.TabSize; }
public static MieFont Convert( MieFont en, MieFont.NFormatType formatTypeEN, MieFont jp, MieFont.NFormatType formatTypeJP, bool forceAdjustAscender) { MieFont newFont = new MieFont(); newFont.Header = en.Header; newFont.FontEntries = jp.FontEntries; newFont.Footer = en.Footer; newFont.Header.Convert( jp.Header, formatTypeEN, forceAdjustAscender); newFont.Footer.Convert(jp.Footer, formatTypeJP); return(newFont); }
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); }
public MieFontInfo(MieFont.NFormatType formatType) { this.formatType = formatType; }