public void Load(string path, NFormatType formatType) { using (BinaryReader br = new BinaryReader(File.OpenRead(path), Encoding.UTF8)) { this.Header = MieFontHeader.Read(br, formatType); this.FontEntries = MieFontEntries.Read(br); this.Footer = MieFontFooter.Read(br, formatType); } }
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 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); }