1 50 51 package com.lowagie.text; 52 53 66 67 public class SpecialSymbol { 68 69 75 public static int index(String string) { 76 int length = string.length(); 77 for (int i = 0; i < length; i++) { 78 if (getCorrespondingSymbol(string.charAt(i)) != ' ') { 79 return i; 80 } 81 } 82 return -1; 83 } 84 85 91 public static Chunk get(char c, Font font) { 92 char greek = SpecialSymbol.getCorrespondingSymbol(c); 93 if (greek == ' ') { 94 return new Chunk(String.valueOf(c), font); 95 } 96 Font symbol = new Font(Font.SYMBOL, font.getSize(), font.getStyle(), font.getColor()); 97 String s = String.valueOf(greek); 98 return new Chunk(s, symbol); 99 } 100 101 107 public static char getCorrespondingSymbol(char c) { 108 switch(c) { 109 case 913: 110 return 'A'; case 914: 112 return 'B'; case 915: 114 return 'G'; case 916: 116 return 'D'; case 917: 118 return 'E'; case 918: 120 return 'Z'; case 919: 122 return 'H'; case 920: 124 return 'Q'; case 921: 126 return 'I'; case 922: 128 return 'K'; case 923: 130 return 'L'; case 924: 132 return 'M'; case 925: 134 return 'N'; case 926: 136 return 'X'; case 927: 138 return 'O'; case 928: 140 return 'P'; case 929: 142 return 'R'; case 931: 144 return 'S'; case 932: 146 return 'T'; case 933: 148 return 'U'; case 934: 150 return 'J'; case 935: 152 return 'C'; case 936: 154 return 'Y'; case 937: 156 return 'W'; case 945: 158 return 'a'; case 946: 160 return 'b'; case 947: 162 return 'g'; case 948: 164 return 'd'; case 949: 166 return 'e'; case 950: 168 return 'z'; case 951: 170 return 'h'; case 952: 172 return 'q'; case 953: 174 return 'i'; case 954: 176 return 'k'; case 955: 178 return 'l'; case 956: 180 return 'm'; case 957: 182 return 'n'; case 958: 184 return 'x'; case 959: 186 return 'o'; case 960: 188 return 'p'; case 961: 190 return 'r'; case 962: 192 return 'V'; case 963: 194 return 's'; case 964: 196 return 't'; case 965: 198 return 'u'; case 966: 200 return 'j'; case 967: 202 return 'c'; case 968: 204 return 'y'; case 969: 206 return 'w'; default: 208 return ' '; 209 } 210 } 211 } | Popular Tags |