176 lines
5.1 KiB
C#
176 lines
5.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Xml;
|
|
|
|
namespace CvtFont
|
|
{
|
|
// <Font Family="Prestige Elite Tall" Size="10" Style="NONE" />
|
|
|
|
public static class CvtFont
|
|
{
|
|
private static string [] OldNames = {
|
|
"ELITE",
|
|
"PICA",
|
|
"LN_PRN",
|
|
"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 = {
|
|
"<Font Family=\"Prestige Elite Tall\" Size=\"10\"/>",
|
|
"<Font Family=\"Courier New\" Size=\"12\"/>",
|
|
"<Font Family=\"Times New Roman\" Size=\"7\"/>",
|
|
"<Font Family=\"Times New Roman\" Size=\"7\"/>",
|
|
"<Font Family=\"Letter Gothic\" Size=\"10\"/>",
|
|
"<Font Family=\"Courier New\" Size=\"12\"/>",
|
|
"<Font Family=\"Arial\" Size=\"18\"/>",
|
|
"<Font Family=\"Arial\" Size=\"11\"/>",
|
|
"<Font Family=\"Times New Roman\" Size=\"18\"/>",
|
|
"<Font Family=\"Times New Roman\" Size=\"25\"/>",
|
|
"<Font Family=\"VolianDraw XXXXXX\" Size=\"12\"/>",
|
|
"<Font Family=\"Letter Gothic\" Size=\"12\"/>",
|
|
"<Font Family=\"Arial\" Size=\"14\"/>",
|
|
"<Font Family=\"Arial\" Size=\"17\"/>",
|
|
"<Font Family=\"Times New Roman\" Size=\"12\"/>",
|
|
"<Font Family=\"Gothic Ultra\" Size=\"12\"/>",
|
|
"<Font Family=\"NA\" Size=\"na\"/>",
|
|
"<Font Family=\"Letter Gothic Tall\" Size=\"7\"/>",
|
|
"<Font Family=\"Arial\" Size=\"0\"/>",
|
|
"<Font Family=\"Letter Gothic Tall\" Size=\"10\"/>",
|
|
"<Font Family=\"Times New Roman\" Size=\"10\"/>",
|
|
"<Font Family=\"Times New Roman\" Size=\"8\"/>",
|
|
"<Font Family=\"Times New Roman\" Size=\"14\"/>",
|
|
"<Font Family=\"Arial\" Size=\"25\"/>",
|
|
"<Font Family=\"Gothic Ultra\" Size=\"14\"/>",
|
|
"<Font Family=\"Times New Roman\" Size=\"11\"/>",
|
|
"<Font Family=\"Letter Gothic\" Size=\"7\"/>",
|
|
"<Font Family=\"VolianScript\" Size=\"32\"/>"
|
|
};
|
|
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<string, string> 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]);
|
|
}
|
|
}
|
|
}
|