using System; using System.Collections.Generic; using System.Text; using System.Xml; namespace CvtFont { // public static class CvtFont { private static string [] OldNames = { "Elite", "Pica", "LnPrn", "Condense", "SanSerif", "Pica12", "Proportional", "Propt12", "HvlPt18", "HvlPt25", "SpecialChars", "Pt14", "SanSerif14", "SanSerif17", "HvlPt12", "Narrator", "MedUpUnivers", "LgUpMed16", "Propt10", "Lg1275Hp4Si", "HvlPt10", "HvlPt8", "HvlPt14", "SanSerif25", "EyeChart", "Times11", "SansCond", "BigScript" }; private static string[] NewXML = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }; private static string[] NewFamily = { "Prestige Elite Tall", "Courier New", "Times New Roman", "Times New Roman", "Letter Gothic", "Courier New", "Arial", "Arial", "Times New Roman", "Times New Roman", "VolianDraw XXXXXX", "Letter Gothic", "Arial", "Arial", "Times New Roman", "Gothic Ultra", "NA", "Letter Gothic Tall", "Arial", "Letter Gothic Tall", "Times New Roman", "Times New Roman", "Times New Roman", "Arial", "Gothic Ultra", "Times New Roman", "Letter Gothic", "VolianScript" }; private static int[] NewSize = { 10, 12, 7, 7, 10, 12, 18, 11, 18, 25, 12, 12, 14, 17, 12, 12, 0, 7, 0, 10, 10, 8, 14, 25, 14, 11, 7, 32 }; private static Dictionary OldToNewStrings=null; public static string ConvertToString(string oldstr) { if (OldToNewStrings == null) InitializeDictionary(); return OldToNewStrings[oldstr]; } public static string ConvertToFamily(string oldstr) { int i = 0; foreach (string str in OldNames) { if (str == oldstr) return NewFamily[i]; i++; } return null; } public static int ConvertToSize(string oldstr) { int i = 0; foreach (string str in OldNames) { if (str == oldstr) return NewSize[i]; i++; } return -1; } //public static XmlElement ConvertToXML(string oldstr) //{ // if (OldToNewStrings == null) InitializeDictionary(); // XmlElement xml = new XmlElement(); // xml.InnerXml = OldToNewStrings[oldstr]; // return xml; //} private static void InitializeDictionary() { int i = 0; foreach (string str in OldNames) OldToNewStrings.Add(str, NewXML[i]); } } }