private void GetWidthData_SP() { if (widthData_SP.Count == 0) { for (int i = 6; i < 0x10; i++) { string path = string.Concat(new object[] { Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"\FontWidthData\sunfon.s", i, ".wdt" }); if (File.Exists(path)) { FileStream input = new FileStream(path, FileMode.Open, FileAccess.Read); BinaryReader reader = new BinaryReader(input); while (reader.BaseStream.Position < reader.BaseStream.Length) { SWidthData data = new SWidthData(); data.FontSize = (byte)i; data.rngFrom = reader.ReadUInt16(); data.rngTo = reader.ReadUInt16(); data.vCount = reader.ReadUInt16(); data.Value = reader.ReadBytes((int)data.vCount); widthData_SP.Add(data); } reader.Close(); input.Close(); } } } }
private void GetWidthData_S60() { if (widthData_S60.Count == 0) { for (int i = 0; i < 2; i++) { string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\FontWidthData\S60CHS." + ((i == 0) ? "S16" : "S12") + ".wdt"; if (File.Exists(path)) { FileStream input = new FileStream(path, FileMode.Open, FileAccess.Read); BinaryReader reader = new BinaryReader(input); while (reader.BaseStream.Position < reader.BaseStream.Length) { SWidthData data = new SWidthData(); data.FontSize = (i == 0) ? ((byte)0x10) : ((byte)12); data.rngFrom = reader.ReadUInt16(); data.rngTo = reader.ReadUInt16(); data.vCount = reader.ReadUInt16(); data.Value = reader.ReadBytes((int)data.vCount); widthData_S60.Add(data); } reader.Close(); input.Close(); } } } }
private void GetWidthData_SP() { this.iWidthData_SP.Clear(); for (int i = 0x10; i < 0x11; i++) { string path = (Assembly.GetExecutingAssembly().CodeBase.Remove(0, 8) + @"\FontWidthData\sunfon.s") + i.ToString() + ".wdt"; if (File.Exists(path)) { FileStream input = new FileStream(path, FileMode.Open, FileAccess.Read); BinaryReader reader = new BinaryReader(input); while (reader.BaseStream.Position < reader.BaseStream.Length) { ushort num2 = reader.ReadUInt16(); ushort num3 = reader.ReadUInt16(); uint num4 = reader.ReadUInt16(); byte[] buffer = new byte[num4]; for (uint j = 0; j < num4; j++) { buffer[j] = reader.ReadByte(); } SWidthData data = new SWidthData(); data.FontSize = (byte)i; data.rngFrom = num2; data.rngTo = num3; data.vCount = num4; data.Value = buffer; this.iWidthData_SP.Add(data); } reader.Close(); input.Close(); } } }
private void GetWidthData_S60() { this.iWidthData_S60.Clear(); for (int i = 0; i < 2; i++) { string path = ""; switch (i) { case 0: path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Remove(0, 8)) + @"\FontWidthData\S60CHS.S16.wdt"; break; case 1: path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Remove(0, 8)) + @"\FontWidthData\S60CHS.S12.wdt"; break; } if (File.Exists(path)) { FileStream input = new FileStream(path, FileMode.Open, FileAccess.Read); BinaryReader reader = new BinaryReader(input); while (reader.BaseStream.Position < reader.BaseStream.Length) { ushort num2 = reader.ReadUInt16(); ushort num3 = reader.ReadUInt16(); uint num4 = reader.ReadUInt16(); byte[] buffer = new byte[num4]; for (uint j = 0; j < num4; j++) { buffer[j] = reader.ReadByte(); } SWidthData data = new SWidthData(); switch (i) { case 0: data.FontSize = 0x10; break; case 1: data.FontSize = 12; break; } data.rngFrom = num2; data.rngTo = num3; data.vCount = num4; data.Value = buffer; this.iWidthData_S60.Add(data); } reader.Close(); input.Close(); } } }
private byte CharWidth_S60(string Char, byte pFontSize) { ushort num = Char[0]; for (int i = 0; i < this.iWidthData_S60.Count; i++) { SWidthData data = (SWidthData)this.iWidthData_S60[i]; if (((data.FontSize == pFontSize) && (num >= data.rngFrom)) && (num <= data.rngTo)) { if (data.vCount == 1) { return(data.Value[0]); } return(data.Value[num - data.rngFrom]); } } return(pFontSize); }