unity3d 修改高棉字体对unity支持

概述
目前unity最新版本也没有对高棉文字进行支持,所以只能通过修改ttf字体文件进行处理
在修改过程中发现多数文本阅读软件对高棉字体显示都是有问题的(如wps,notepad++),最后选择了window自己的txt记事本为显示标准,果然全球化最牛b的还是window系统
高棉在unity显示问题
在这里插入图片描述
如图,原始高棉ttf字体在unity显示错误,经过处理字体文件后的显示结果,最后加上逻辑处理就可以正确显示了
1,多数偏旁Unicode映射失败,或者映射错乱
2,合成符Unicode映射失败
3,连体字Unicode映射失败
3,各类占位符直接显示出来了
4,(上下)(左右)(上中下)(左中右)等一些字体结构组成错误
5,连接符位置错误
修改: 多数偏旁Unicode映射失败,或者映射错乱
这里使用的是FontCreator9.0软件进行ttf字体文件的修改
在这里插入图片描述
网上资料都写的高棉字的Unicode映射范围
1780-17FF #高棉语
19E0-19FF#高棉语记号

修改: 字体映射1780.sub1到17B3.sub1到新的映射Unicode码(1004到1055)
为什么修改成1004到1055,没有为什么,就随便选的,只要不跟高棉语本身的映射范围范围冲突就可以了
在这里插入图片描述
配合修改映射关系代码

    fixStr = fixStr.Replace("\\u17D2\\u1780", "\\u1004");
    fixStr = fixStr.Replace("\\u17D2\\u1781", "\\u1005");
    fixStr = fixStr.Replace("\\u17D2\\u1782", "\\u1006");
    fixStr = fixStr.Replace("\\u17D2\\u1783", "\\u1007");
    fixStr = fixStr.Replace("\\u17D2\\u1784", "\\u1008");
    fixStr = fixStr.Replace("\\u17D2\\u1785", "\\u1009");
    fixStr = fixStr.Replace("\\u17D2\\u1786", "\\u1010");
    fixStr = fixStr.Replace("\\u17D2\\u1787", "\\u1011");
    fixStr = fixStr.Replace("\\u17D2\\u1788", "\\u1012");
    fixStr = fixStr.Replace("\\u17D2\\u1789", "\\u1013");
    fixStr = fixStr.Replace("\\u17D2\\u178A", "\\u1014");
    fixStr = fixStr.Replace("\\u17D2\\u178B", "\\u1015");
    fixStr = fixStr.Replace("\\u17D2\\u178C", "\\u1016");
    fixStr = fixStr.Replace("\\u17D2\\u178D", "\\u1017");
    fixStr = fixStr.Replace("\\u17D2\\u178E", "\\u1018");
    fixStr = fixStr.Replace("\\u17D2\\u178F", "\\u1019");
    fixStr = fixStr.Replace("\\u17D2\\u1790", "\\u1020");
    fixStr = fixStr.Replace("\\u17D2\\u1791", "\\u1021");
    fixStr = fixStr.Replace("\\u17D2\\u1792", "\\u1022");
    fixStr = fixStr.Replace("\\u17D2\\u1793", "\\u1023");
    fixStr = fixStr.Replace("\\u17D2\\u1794", "\\u1024");
    fixStr = fixStr.Replace("\\u17D2\\u1795", "\\u1025");
    fixStr = fixStr.Replace("\\u17D2\\u1796", "\\u1026");
    fixStr = fixStr.Replace("\\u17D2\\u1797", "\\u1027");
    fixStr = fixStr.Replace("\\u17D2\\u1798", "\\u1028");
    fixStr = fixStr.Replace("\\u17D2\\u1799", "\\u1029");
    fixStr = fixStr.Replace("\\u17D2\\u179A", "\\u1030");
    fixStr = fixStr.Replace("\\u17D2\\u179B", "\\u1031");
    fixStr = fixStr.Replace("\\u17D2\\u179C", "\\u1032");
    fixStr = fixStr.Replace("\\u17D2\\u179D", "\\u1033");
    fixStr = fixStr.Replace("\\u17D2\\u179E", "\\u1034");
    fixStr = fixStr.Replace("\\u17D2\\u179F", "\\u1035");
    fixStr = fixStr.Replace("\\u17D2\\u17A0", "\\u1036");
    fixStr = fixStr.Replace("\\u17D2\\u17A1", "\\u1037");
    fixStr = fixStr.Replace("\\u17D2\\u17A2", "\\u1038");
    fixStr = fixStr.Replace("\\u17D2\\u17A3", "\\u1039");
    fixStr = fixStr.Replace("\\u17D2\\u17A4", "\\u1040");
    fixStr = fixStr.Replace("\\u17D2\\u17A5", "\\u1041");
    fixStr = fixStr.Replace("\\u17D2\\u17A6", "\\u1042");
    fixStr = fixStr.Replace("\\u17D2\\u17A7", "\\u1043");
    fixStr = fixStr.Replace("\\u17D2\\u17A8", "\\u1044");
    fixStr = fixStr.Replace("\\u17D2\\u17A9", "\\u1045");
    fixStr = fixStr.Replace("\\u17D2\\u17AA", "\\u1046");
    fixStr = fixStr.Replace("\\u17D2\\u17AB", "\\u1047");
    fixStr = fixStr.Replace("\\u17D2\\u17AC", "\\u1048");
    fixStr = fixStr.Replace("\\u17D2\\u17AD", "\\u1049");
    fixStr = fixStr.Replace("\\u17D2\\u17AE", "\\u1050");
    fixStr = fixStr.Replace("\\u17D2\\u17AF", "\\u1051");
    fixStr = fixStr.Replace("\\u17D2\\u17B0", "\\u1052");
    fixStr = fixStr.Replace("\\u17D2\\u17B1", "\\u1053");
    fixStr = fixStr.Replace("\\u17D2\\u17B2", "\\u1054");
    fixStr = fixStr.Replace("\\u17D2\\u17B3", "\\u1055");

修改: 占位符的映射Unicode码(1080到1084)(需要把1个u码分解成2个,还好只有5个字)
在这里插入图片描述
配合修改映射关系代码

        fixStr = fixStr.Replace("\\u17BE", "\\u17C1\\u1080");
        fixStr = fixStr.Replace("\\u17BF", "\\u17C1\\u1081");
        fixStr = fixStr.Replace("\\u17C0", "\\u17C1\\u1082");
        fixStr = fixStr.Replace("\\u17C4", "\\u17C1\\u1083");
        fixStr = fixStr.Replace("\\u17C5", "\\u17C1\\u1084");

修改: 合成符178017B6到17A217B6到新的映射Unicode码(1101到1135)
在这里插入图片描述
配合修改映射关系代码

        fixStr = fixStr.Replace("\\u1780\\u17B6", "\\u1101");
        fixStr = fixStr.Replace("\\u1781\\u17B6", "\\u1102");
        fixStr = fixStr.Replace("\\u1782\\u17B6", "\\u1103");
        fixStr = fixStr.Replace("\\u1783\\u17B6", "\\u1104");
        fixStr = fixStr.Replace("\\u1784\\u17B6", "\\u1105");
        fixStr = fixStr.Replace("\\u1785\\u17B6", "\\u1106");
        fixStr = fixStr.Replace("\\u1786\\u17B6", "\\u1107");
        fixStr = fixStr.Replace("\\u1787\\u17B6", "\\u1108");
        fixStr = fixStr.Replace("\\u1788\\u17B6", "\\u1109");
        fixStr = fixStr.Replace("\\u1789\\u17B6", "\\u1110");
        fixStr = fixStr.Replace("\\u178A\\u17B6", "\\u1111");
        fixStr = fixStr.Replace("\\u178B\\u17B6", "\\u1112");
        fixStr = fixStr.Replace("\\u178C\\u17B6", "\\u1113");
        fixStr = fixStr.Replace("\\u178D\\u17B6", "\\u1114");
        fixStr = fixStr.Replace("\\u178E\\u17B6", "\\u1115");
        fixStr = fixStr.Replace("\\u178F\\u17B6", "\\u1116");
        fixStr = fixStr.Replace("\\u1790\\u17B6", "\\u1117");
        fixStr = fixStr.Replace("\\u1791\\u17B6", "\\u1118");
        fixStr = fixStr.Replace("\\u1792\\u17B6", "\\u1119");
        fixStr = fixStr.Replace("\\u1793\\u17B6", "\\u1120");
        fixStr = fixStr.Replace("\\u1794\\u17B6", "\\u1121");
        fixStr = fixStr.Replace("\\u1795\\u17B6", "\\u1122");
        fixStr = fixStr.Replace("\\u1796\\u17B6", "\\u1123");
        fixStr = fixStr.Replace("\\u1797\\u17B6", "\\u1124");
        fixStr = fixStr.Replace("\\u1798\\u17B6", "\\u1125");
        fixStr = fixStr.Replace("\\u1799\\u17B6", "\\u1126");
        fixStr = fixStr.Replace("\\u179A\\u17B6", "\\u1127");
        fixStr = fixStr.Replace("\\u179B\\u17B6", "\\u1128");
        fixStr = fixStr.Replace("\\u179C\\u17B6", "\\u1129");
        fixStr = fixStr.Replace("\\u179D\\u17B6", "\\u1130");
        fixStr = fixStr.Replace("\\u179E\\u17B6", "\\u1131");
        fixStr = fixStr.Replace("\\u179F\\u17B6", "\\u1132");
        fixStr = fixStr.Replace("\\u17A0\\u17B6", "\\u1133");
        fixStr = fixStr.Replace("\\u17A1\\u17B6", "\\u1134");
        fixStr = fixStr.Replace("\\u17A2\\u17B6", "\\u1135");

修改: 合成符178017C5到17A217C5到新的映射Unicode码(1137到1171)
在这里插入图片描述
配合修改映射关系代码

        fixStr = fixStr.Replace("\\u1780\\u17C5", "\\u17C1\\u1137");
        fixStr = fixStr.Replace("\\u1781\\u17C5", "\\u17C1\\u1138");
        fixStr = fixStr.Replace("\\u1782\\u17C5", "\\u17C1\\u1139");
        fixStr = fixStr.Replace("\\u1783\\u17C5", "\\u17C1\\u1140");
        fixStr = fixStr.Replace("\\u1784\\u17C5", "\\u17C1\\u1141");
        fixStr = fixStr.Replace("\\u1785\\u17C5", "\\u17C1\\u1142");
        fixStr = fixStr.Replace("\\u1786\\u17C5", "\\u17C1\\u1143");
        fixStr = fixStr.Replace("\\u1787\\u17C5", "\\u17C1\\u1144");
        fixStr = fixStr.Replace("\\u1788\\u17C5", "\\u17C1\\u1145");
        fixStr = fixStr.Replace("\\u1789\\u17C5", "\\u17C1\\u1146");
        fixStr = fixStr.Replace("\\u178A\\u17C5", "\\u17C1\\u1147");
        fixStr = fixStr.Replace("\\u178B\\u17C5", "\\u17C1\\u1148");
        fixStr = fixStr.Replace("\\u178C\\u17C5", "\\u17C1\\u1149");
        fixStr = fixStr.Replace("\\u178D\\u17C5", "\\u17C1\\u1150");
        fixStr = fixStr.Replace("\\u178E\\u17C5", "\\u17C1\\u1151");
        fixStr = fixStr.Replace("\\u178F\\u17C5", "\\u17C1\\u1152");
        fixStr = fixStr.Replace("\\u1790\\u17C5", "\\u17C1\\u1153");
        fixStr = fixStr.Replace("\\u1791\\u17C5", "\\u17C1\\u1154");
        fixStr = fixStr.Replace("\\u1792\\u17C5", "\\u17C1\\u1155");
        fixStr = fixStr.Replace("\\u1793\\u17C5", "\\u17C1\\u1156");
        fixStr = fixStr.Replace("\\u1794\\u17C5", "\\u17C1\\u1157");
        fixStr = fixStr.Replace("\\u1795\\u17C5", "\\u17C1\\u1158");
        fixStr = fixStr.Replace("\\u1796\\u17C5", "\\u17C1\\u1159");
        fixStr = fixStr.Replace("\\u1797\\u17C5", "\\u17C1\\u1160");
        fixStr = fixStr.Replace("\\u1798\\u17C5", "\\u17C1\\u1161");
        fixStr = fixStr.Replace("\\u1799\\u17C5", "\\u17C1\\u1162");
        fixStr = fixStr.Replace("\\u179A\\u17C5", "\\u17C1\\u1163");
        fixStr = fixStr.Replace("\\u179B\\u17C5", "\\u17C1\\u1164");
        fixStr = fixStr.Replace("\\u179C\\u17C5", "\\u17C1\\u1165");
        fixStr = fixStr.Replace("\\u179D\\u17C5", "\\u17C1\\u1166");
        fixStr = fixStr.Replace("\\u179E\\u17C5", "\\u17C1\\u1167");
        fixStr = fixStr.Replace("\\u179F\\u17C5", "\\u17C1\\u1168");
        fixStr = fixStr.Replace("\\u17A0\\u17C5", "\\u17C1\\u1169");
        fixStr = fixStr.Replace("\\u17A1\\u17C5", "\\u17C1\\u1170");
        fixStr = fixStr.Replace("\\u17A2\\u17C5", "\\u17C1\\u1171");

修改: 合成符17D2178917B6到17D2179F17B6到新的映射Unicode码(1085到1092)
在这里插入图片描述
配合修改映射关系代码

        fixStr = fixStr.Replace("\\u17D2\\u1789\\u17B6", "\\u1085");
        fixStr = fixStr.Replace("\\u17D2\\u1783\\u17B6", "\\u1086");
        fixStr = fixStr.Replace("\\u17D2\\u1788\\u17B6", "\\u1087");
        fixStr = fixStr.Replace("\\u17D2\\u178D\\u17B6", "\\u1088");
        fixStr = fixStr.Replace("\\u17D2\\u1794\\u17B6", "\\u1089");
        fixStr = fixStr.Replace("\\u17D2\\u1799\\u17B6", "\\u1090");
        fixStr = fixStr.Replace("\\u17D2\\u179E\\u17B6", "\\u1091");
        fixStr = fixStr.Replace("\\u17D2\\u179F\\u17B6", "\\u1092");

修改: 字体结构组成错误
1:转换字符串成Unicode码(因为在处理结构逻辑的时候需要平凡移动每个Unicode码前后顺序,为了防止逻辑数组越界,所有直接在数据前后分别加上了0010的Unicode码,用来占位,没有实际的显示效果)

        var bytes = Encoding.Unicode.GetBytes(source);
        var stringBuilder = new StringBuilder();
        stringBuilder.Append("u0010");
        for (var i = 0; i < bytes.Length; i += 2)
        {
            stringBuilder.AppendFormat("u{0:X2}{1:X2}", bytes[i + 1], bytes[i]);
        }
        stringBuilder.Append("u0010");
        string fixStr = stringBuilder.ToString();
        
        string[] strlist = fixStr.Split('u');
        int strlistLength = strlist.Length;
        for (int i = 0; i < strlistLength; i++)
        {
            string cuTemp = strlist[i];//当前Unicode码
            if (i - 1 >= 0 && i + 1 < strlistLength)
            {
                 string chNext = strlist[i + 1];  //后面一个Unicode码
                 string perTemp = strlist[i - 1]; //前面一个Unicode码
                 /.................................
                 //这里添加处理字体结构逻辑代码
                 ................................./
            }
        }

链接字符处理,后面有一个链接符,链接符号往前跳到一个单体字为止如(ក្រៅ ង្គ្រោះ)

  if (chNext == "1080" ||
                chNext == "1081" ||
                chNext == "1082" ||
                chNext == "1083" ||
                chNext == "1084"||
                chNext == "17BC")
            {
                int i_Temp = i-1;
                while (i_Temp >= 0 && (strlist[i_Temp] == "17C1" || strlist[i_Temp] == "1030"))
                {
                    i_Temp--;
                }
                string vhTemp = strlist[i_Temp];
                i_Temp += 1;
                while (i_Temp <= i)
                {
                    strlist[i_Temp - 1] = strlist[i_Temp];
                    i_Temp++;
                }
                strlist[i] = vhTemp;
            }

单个字体去掉下面部分,用1789替代情况如(ញ្ជើ ញ្ច)

            if (chNext == "1009" || chNext == "1011" || chNext == "1012" || chNext == "1013" || chNext == "1014" || chNext == "1015" || chNext == "1006" ||
                    chNext == "1017" || chNext == "1018" || chNext == "1019" || chNext == "1020" || chNext == "1021" || chNext == "1022" ||
                    chNext == "1023" || chNext == "1024" || chNext == "1025" || chNext == "1026" || chNext == "1027" || chNext == "1028"||
                    chNext == "1029" || chNext == "1030" || chNext == "1031" || chNext == "1032" || chNext == "1033" || chNext == "1034"||
                    chNext == "1035")
                {
                    if (i + 2 < strlistLength && strlist[i + 2] == "17B6")
                    {
                        strlist[i + 1] = strlist[i + 2];
                        strlist[i + 2] = chNext;
                    }
                    else
                    {
                        if (cuTemp == "1789") strlist[i] = "1184";
                }
            }

左右包围的字如(ម្រា)

  if ((cuTemp == "1030" && (chNext == "17B6" || chNext == "17B4" || chNext == "17B5")))
            {
                if (i - 1 >= 0)
                {
                    strlist[i] = strlist[i - 1];
                    strlist[i - 1] = cuTemp;
                }
            }

合体字去掉下面部分,移动2边在一起合体如(ញ្ជា ប់យ៉ា)

            if (i + 2 < strlistLength)
            {
                string newchNext = strlist[i + 2];
                if (newchNext == "17B6")
                {
                    if (cuTemp == "1789"){ strlist[i] = "1093";strlist[i + 2] = "0010";}
                    else if (cuTemp == "1783") { strlist[i] = "1104"; strlist[i + 2] = "0010"; }//没下面部分
                    else if (cuTemp == "1788") { strlist[i] = "1109"; strlist[i + 2] = "0010"; }//没下面部分
                    else if (cuTemp == "178D") { strlist[i] = "1114"; strlist[i + 2] = "0010"; }//没下面部分
                    else if (cuTemp == "1794") { strlist[i] = "1121"; strlist[i + 2] = "0010"; }//没下面部分
                    else if (cuTemp == "1799"){  strlist[i] = "1126";strlist[i + 2] = "0010" ;}//没下面部分
                    else if (cuTemp == "179E"){  strlist[i] = "1099";strlist[i + 2] = "0010";}
                    else if (cuTemp == "179F" && chNext != "1038") { strlist[i] = "1100"; strlist[i + 2] = "0010"; }//去1038
                   
                }
            }

上面有一点的偏旁处理如(ប់ យ៉ា)

            if (cuTemp == "17CB")
            {
                if (i + 1 < strlistLength)
                { 
                      string chNext = strlist[i + 1];
                      if (chNext == "17B6")
                      {
                          strlist[i + 1] = cuTemp;
                          strlist[i] = chNext;
                      }
                }
            }

几种特殊字符需要前移动一位如(ក្រោ ព្រៃ)

            if ((cuTemp == "1030" || cuTemp == "17C3" || cuTemp == "1183") && (perTemp == "1780" || perTemp == "1781" || perTemp == "1782" || perTemp == "1783" || perTemp == "1784" ||
                perTemp == "1785" || perTemp == "1786" || perTemp == "1787" || perTemp == "1788" || perTemp == "1789" || perTemp == "178A" || perTemp == "178B" || perTemp == "178C" || perTemp == "178D" ||
                perTemp == "178E" || perTemp == "178F" || perTemp == "1791" || perTemp == "1792" || perTemp == "1793" || perTemp == "1794" || perTemp == "1795" || perTemp == "1796" ||
                perTemp == "1797" || perTemp == "1798" || perTemp == "1799" || perTemp == "179F"))//几种特殊字符需要前移动一位如(ក្រោ ព្រៃ)
            {
                if (i - 1 >= 0)
                {
                    strlist[i] = strlist[i - 1];
                    strlist[i - 1] = cuTemp;
                }
            }

几种特殊字符需要前移动两位如(ម៉ែន ន្តែជា)

            if ((perTemp == "1004" || perTemp == "1005" || perTemp == "1006" || perTemp == "1007" || perTemp == "1008" || perTemp == "1009" ||
              perTemp == "1010" || perTemp == "1011" || perTemp == "1012" || perTemp == "1013" || perTemp == "1085" || perTemp == "1014" ||
              perTemp == "1015" || perTemp == "1016" || perTemp == "1017" || perTemp == "1018" || perTemp == "1019" || perTemp == "1020" ||
              perTemp == "1021" || perTemp == "1022" || perTemp == "1023" || perTemp == "1024" || perTemp == "1025" || perTemp == "1026" ||
              perTemp == "1027" || perTemp == "1028" || perTemp == "1029" || perTemp == "1030" || perTemp == "1031" || perTemp == "1032" ||
              perTemp == "1033" || perTemp == "1034" || perTemp == "1035" || perTemp == "1036" || perTemp == "1037" || perTemp == "1038" ||
              perTemp == "1039" || perTemp == "1040" || perTemp == "1041" || perTemp == "1042" || perTemp == "1043" || perTemp == "1044" ||
              perTemp == "1045" || perTemp == "1046" || perTemp == "1047" || perTemp == "1048" || perTemp == "1049" || perTemp == "1050" ||
              perTemp == "1051" || perTemp == "1052" || perTemp == "1053" || perTemp == "1054" || perTemp == "1055" || perTemp == "17CA" ||
              perTemp == "17CB" || perTemp == "17CC" || perTemp == "17CD" || perTemp == "17CE" || perTemp == "17C6" ||
              perTemp == "17C9" ||
              perTemp == "1181") && (
              perTemp != "17C7" &&
              perTemp != "179A" &&
              perTemp != "1798"
              ) && ( 
              chNext != "1169" && chNext != "1154" && chNext != "1030" && chNext != "1156" &&
              chNext != "1101" && chNext != "1102" && chNext != "1103" && chNext != "1104" && chNext != "1105" && chNext != "1106" &&
              chNext != "1107" && chNext != "1109" && chNext != "1110" && chNext != "1111" && chNext != "1112" &&
              chNext != "1113" && chNext != "1114" && chNext != "1115" && chNext != "1116" && chNext != "1117" && chNext != "1118" &&
              chNext != "1119" && chNext != "1120" && chNext != "1121" && chNext != "1122" && chNext != "1123" && chNext != "1124" &&
              chNext != "1126" && chNext != "1127" && chNext != "1128" && chNext != "1129" && chNext != "1130" &&
              chNext != "1131" && chNext != "1132" && chNext != "1133" && chNext != "1134"))
                {
                    if (i - 2 >= 0)
                    {
                        string vhTemp = strlist[i - 2];
                        strlist[i - 2] = cuTemp;
                        strlist[i] = strlist[i - 1];
                        strlist[i - 1] = vhTemp;
                    }
                }

结构逻辑处理完之后,合成符号需要在处理一次

          if (cuTemp == "17B6")
          {
              if (strlist[i - 1] == "1780") { strlist[i - 1] = "0010"; strlist[i] = "1101"; }
              else if (strlist[i - 1] == "1781") { strlist[i - 1] = "0010"; strlist[i] = "1102"; }
              else if (strlist[i - 1] == "1782") { strlist[i - 1] = "0010"; strlist[i] = "1103"; }
              else if (strlist[i - 1] == "1783") { strlist[i - 1] = "0010"; strlist[i] = "1104"; }
              else if (strlist[i - 1] == "1784") { strlist[i - 1] = "0010"; strlist[i] = "1105"; }
              else if (strlist[i - 1] == "1785") { strlist[i - 1] = "0010"; strlist[i] = "1106"; }
              else if (strlist[i - 1] == "1786") { strlist[i - 1] = "0010"; strlist[i] = "1107"; }
              else if (strlist[i - 1] == "1787") { strlist[i - 1] = "0010"; strlist[i] = "1108"; }
              else if (strlist[i - 1] == "1788") { strlist[i - 1] = "0010"; strlist[i] = "1109"; }
              else if (strlist[i - 1] == "1789") { strlist[i - 1] = "0010"; strlist[i] = "1110"; }
              else if (strlist[i - 1] == "178A") { strlist[i - 1] = "0010"; strlist[i] = "1111"; }
              else if (strlist[i - 1] == "178B") { strlist[i - 1] = "0010"; strlist[i] = "1112"; }
              else if (strlist[i - 1] == "178C") { strlist[i - 1] = "0010"; strlist[i] = "1113"; }
              else if (strlist[i - 1] == "178D") { strlist[i - 1] = "0010"; strlist[i] = "1114"; }
              else if (strlist[i - 1] == "178E") { strlist[i - 1] = "0010"; strlist[i] = "1115"; }
              else if (strlist[i - 1] == "178F") { strlist[i - 1] = "0010"; strlist[i] = "1116"; }
              else if (strlist[i - 1] == "1790") { strlist[i - 1] = "0010"; strlist[i] = "1117"; }
              else if (strlist[i - 1] == "1791") { strlist[i - 1] = "0010"; strlist[i] = "1118"; }
              else if (strlist[i - 1] == "1792") { strlist[i - 1] = "0010"; strlist[i] = "1119"; }
              else if (strlist[i - 1] == "1793") { strlist[i - 1] = "0010"; strlist[i] = "1120"; }
              else if (strlist[i - 1] == "1794") { strlist[i - 1] = "0010"; strlist[i] = "1121"; }
              else if (strlist[i - 1] == "1795") { strlist[i - 1] = "0010"; strlist[i] = "1122"; }
              else if (strlist[i - 1] == "1796") { strlist[i - 1] = "0010"; strlist[i] = "1123"; }
              else if (strlist[i - 1] == "1797") { strlist[i - 1] = "0010"; strlist[i] = "1124"; }
              else if (strlist[i - 1] == "1798") { strlist[i - 1] = "0010"; strlist[i] = "1125"; }
              else if (strlist[i - 1] == "1799") { strlist[i - 1] = "0010"; strlist[i] = "1126"; }
              else if (strlist[i - 1] == "179A") { strlist[i - 1] = "0010"; strlist[i] = "1127"; }
              else if (strlist[i - 1] == "179B") { strlist[i - 1] = "0010"; strlist[i] = "1128"; }
              else if (strlist[i - 1] == "179C") { strlist[i - 1] = "0010"; strlist[i] = "1129"; }
              else if (strlist[i - 1] == "179D") { strlist[i - 1] = "0010"; strlist[i] = "1130"; }
              else if (strlist[i - 1] == "179E") { strlist[i - 1] = "0010"; strlist[i] = "1131"; }
              else if (strlist[i - 1] == "179F") { strlist[i - 1] = "0010"; strlist[i] = "1132"; }
              else if (strlist[i - 1] == "17A0") { strlist[i - 1] = "0010"; strlist[i] = "1133"; }
              else if (strlist[i - 1] == "17A1") { strlist[i - 1] = "0010"; strlist[i] = "1134"; }
              else if (strlist[i - 1] == "17A2") { strlist[i - 1] = "0010"; strlist[i] = "1135"; }
              if (i + 1 < strlist.Length && strlist[i + 1] == "1030")
              {
                  strlist[i + 1] = strlist[i];
                  strlist[i] = "1030";
              }
          }
          if (cuTemp == "17C4")
          {
              if (strlist[i - 1] == "1780") { strlist[i - 1] = "17C1"; strlist[i] = "1101"; }
              else if (strlist[i - 1] == "1781") { strlist[i - 1] = "17C1"; strlist[i] = "1102"; }
              else if (strlist[i - 1] == "1782") { strlist[i - 1] = "17C1"; strlist[i] = "1103"; }
              else if (strlist[i - 1] == "1783") { strlist[i - 1] = "17C1"; strlist[i] = "1104"; }
              else if (strlist[i - 1] == "1784") { strlist[i - 1] = "17C1"; strlist[i] = "1105"; }
              else if (strlist[i - 1] == "1785") { strlist[i - 1] = "17C1"; strlist[i] = "1106"; }
              else if (strlist[i - 1] == "1786") { strlist[i - 1] = "17C1"; strlist[i] = "1107"; }
              else if (strlist[i - 1] == "1787") { strlist[i - 1] = "17C1"; strlist[i] = "1108"; }
              else if (strlist[i - 1] == "1788") { strlist[i - 1] = "17C1"; strlist[i] = "1109"; }
              else if (strlist[i - 1] == "1789") { strlist[i - 1] = "17C1"; strlist[i] = "1110"; }
              else if (strlist[i - 1] == "178A") { strlist[i - 1] = "17C1"; strlist[i] = "1111"; }
              else if (strlist[i - 1] == "178B") { strlist[i - 1] = "17C1"; strlist[i] = "1112"; }
              else if (strlist[i - 1] == "178C") { strlist[i - 1] = "17C1"; strlist[i] = "1113"; }
              else if (strlist[i - 1] == "178D") { strlist[i - 1] = "17C1"; strlist[i] = "1114"; }
              else if (strlist[i - 1] == "178E") { strlist[i - 1] = "17C1"; strlist[i] = "1115"; }
              else if (strlist[i - 1] == "178F") { strlist[i - 1] = "17C1"; strlist[i] = "1116"; }
              else if (strlist[i - 1] == "1790") { strlist[i - 1] = "17C1"; strlist[i] = "1117"; }
              else if (strlist[i - 1] == "1791") { strlist[i - 1] = "17C1"; strlist[i] = "1118"; }
              else if (strlist[i - 1] == "1792") { strlist[i - 1] = "17C1"; strlist[i] = "1119"; }
              else if (strlist[i - 1] == "1793") { strlist[i - 1] = "17C1"; strlist[i] = "1120"; }
              else if (strlist[i - 1] == "1794") { strlist[i - 1] = "17C1"; strlist[i] = "1121"; }
              else if (strlist[i - 1] == "1795") { strlist[i - 1] = "17C1"; strlist[i] = "1122"; }
              else if (strlist[i - 1] == "1796") { strlist[i - 1] = "17C1"; strlist[i] = "1123"; }
              else if (strlist[i - 1] == "1797") { strlist[i - 1] = "17C1"; strlist[i] = "1124"; }
              else if (strlist[i - 1] == "1798") { strlist[i - 1] = "17C1"; strlist[i] = "1125"; }
              else if (strlist[i - 1] == "1799") { strlist[i - 1] = "17C1"; strlist[i] = "1126"; }
              else if (strlist[i - 1] == "179A") { strlist[i - 1] = "17C1"; strlist[i] = "1127"; }
              else if (strlist[i - 1] == "179B") { strlist[i - 1] = "17C1"; strlist[i] = "1128"; }
              else if (strlist[i - 1] == "179C") { strlist[i - 1] = "17C1"; strlist[i] = "1129"; }
              else if (strlist[i - 1] == "179D") { strlist[i - 1] = "17C1"; strlist[i] = "1130"; }
              else if (strlist[i - 1] == "179E") { strlist[i - 1] = "17C1"; strlist[i] = "1131"; }
              else if (strlist[i - 1] == "179F") { strlist[i - 1] = "17C1"; strlist[i] = "1132"; }
              else if (strlist[i - 1] == "17A0") { strlist[i - 1] = "17C1"; strlist[i] = "1133"; }
              else if (strlist[i - 1] == "17A1") { strlist[i - 1] = "17C1"; strlist[i] = "1134"; }
              else if (strlist[i - 1] == "17A2") { strlist[i - 1] = "17C1"; strlist[i] = "1135"; }
              if (i - 2 >= 0 && strlist[i - 2] == "1030")
              {
                  strlist[i - 1] = strlist[i - 2];
                  strlist[i - 2] = "17C1";
              }
          }

17C4特殊字体在进一步处理

                for (int i = 1; i < strlist.Length; i++)
                {
                    if (i + 2 < strlist.Length && strlist[i + 2] == "17C4")
                    {
                          string perTemp = strlist[i + 1];
                          if (perTemp == "1004" || perTemp == "1005" || perTemp == "1006" || perTemp == "1007" || perTemp == "1008" || perTemp == "1009" ||
                                perTemp == "1010" || perTemp == "1011" || perTemp == "1012" || perTemp == "1013" || perTemp == "1085" || perTemp == "1014" ||
                                perTemp == "1015" || perTemp == "1016" || perTemp == "1017" || perTemp == "1018" || perTemp == "1019" || perTemp == "1020" ||
                                perTemp == "1021" || perTemp == "1022" || perTemp == "1023" || perTemp == "1024" || perTemp == "1025" || perTemp == "1026" ||
                                perTemp == "1027" || perTemp == "1028" || perTemp == "1029" || perTemp == "1030" || perTemp == "1031" || perTemp == "1032" ||
                                perTemp == "1033" || perTemp == "1034" || perTemp == "1035" || perTemp == "1036" || perTemp == "1037" || perTemp == "1038" ||
                                perTemp == "1039" || perTemp == "1040" || perTemp == "1041" || perTemp == "1042" || perTemp == "1043" || perTemp == "1044" ||
                                perTemp == "1045" || perTemp == "1046" || perTemp == "1047" || perTemp == "1048" || perTemp == "1049" || perTemp == "1050" ||
                                perTemp == "1051" || perTemp == "1052" || perTemp == "1053" || perTemp == "1054" || perTemp == "1055" || perTemp == "17CA" ||
                                perTemp == "17CB" || perTemp == "17CC" || perTemp == "17CD" || perTemp == "17CE" || perTemp == "17C6" ||
                                perTemp == "17C9" ||
                                perTemp == "1181")
                          {
                              char vp = (char)int.Parse("17C1", System.Globalization.NumberStyles.HexNumber);
                              finalText += vp;
                              char vc1 = (char)int.Parse(strlist[i], System.Globalization.NumberStyles.HexNumber);
                              finalText += vc1;
                              char vc2 = (char)int.Parse(strlist[i + 1], System.Globalization.NumberStyles.HexNumber);
                              finalText += vc2;
                              char vn = (char)int.Parse("1083", System.Globalization.NumberStyles.HexNumber);
                              finalText += vn;
                              i += 2;
                          }
                          else
                          {
                              char v = (char)int.Parse(strlist[i], System.Globalization.NumberStyles.HexNumber);
                              finalText += v;
                          }
                    }
                    else
                    {
                        char v = (char)int.Parse(strlist[i], System.Globalization.NumberStyles.HexNumber);
                        finalText += v;
                    }
                
                }

逻辑处理顺序也很重要
感悟: 痛并快乐着!!!

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值