//----------------------------------------------------------------------------------------------------x
            /// <summary></summary>
            /// <param name="sLine"></param>
            /// <param name="type1FontData"></param>
            internal CharMetrics(String sLine, Type1FontData type1FontData)
            {
                String[] asLineToken = sLine.Split(Type1FontData.acDelimiterSemicolon, 10);
                if (asLineToken.Length <= 2)
                {
                    throw new ReportException("Invalid character metrics definition in AFM file: " + type1FontData.sFontName);
                }
                for (Int32 iExpr = 0; iExpr < asLineToken.Length; iExpr++)
                {
                    if (asLineToken[iExpr].Length == 0)
                    {
                        continue;
                    }
                    String[] asToken = asLineToken[iExpr].Trim().Split(acDelimiterToken, 5);
                    switch (asToken[0])
                    {
                    case "C": { iCharacterCode = Int32.Parse(asToken[1]);  break; }

                    case "CH": { iCharacterCode = Int32.Parse(asToken[1], System.Globalization.NumberStyles.HexNumber);  break; }

                    case "WX":
                    case "W0X": { fWidthX = Single.Parse(asToken[1]);  break; }

                    case "N": { sName = asToken[1];  break; }

                    case "B": {
                        fBBox_llx = Single.Parse(asToken[1]);
                        fBBox_lly = Single.Parse(asToken[2]);
                        fBBox_urx = Single.Parse(asToken[3]);
                        fBBox_ury = Single.Parse(asToken[4]);
                        break;
                    }

                    case "L": {
                        if (al_Ligature == null)
                        {
                            al_Ligature = new ArrayList(10);
                        }
                        al_Ligature.Add(new Ligature(asToken[1], asToken[2]));
                        break;
                    }

                    default: {
                        Debug.Fail("Unknown token [" + asToken[0] + "] in AFM file: " + type1FontData.sFontName);
                        break;
                    }
                    }
                }

                // find index
                Int32 iIndex = iCharacterCode;

                if (type1FontData.sFontName != "Symbol" && type1FontData.sFontName != "ZapfDingbats")
                {
                    switch (iIndex)
                    {
                    case  39:  iIndex = 0;  break;   // quoteright

                    case  96:  iIndex = 0;  break;   // quoteleft

                    case 127:  iIndex = -1;  break;  // does not exist!

                    case 128:  iIndex = -1;  break;  // does not exist!

                    case 129:  iIndex = -1;  break;  // does not exist!

                    case 130:  iIndex = -1;  break;  // does not exist!

                    case 131:  iIndex = -1;  break;  // does not exist!

                    case 132:  iIndex = -1;  break;  // does not exist!

                    case 133:  iIndex = -1;  break;  // does not exist!

                    case 134:  iIndex = -1;  break;  // does not exist!

                    case 135:  iIndex = -1;  break;  // does not exist!

                    case 136:  iIndex = -1;  break;  // does not exist!

                    case 137:  iIndex = -1;  break;  // does not exist!

                    case 138:  iIndex = -1;  break;  // does not exist!

                    case 139:  iIndex = -1;  break;  // does not exist!

                    case 140:  iIndex = -1;  break;  // does not exist!

                    case 141:  iIndex = -1;  break;  // does not exist!

                    case 142:  iIndex = -1;  break;  // does not exist!

                    case 143:  iIndex = -1;  break;  // does not exist!

                    case 144:  iIndex = -1;  break;  // does not exist!

                    case 145:  iIndex = -1;  break;  // does not exist!

                    case 146:  iIndex = -1;  break;  // does not exist!

                    case 147:  iIndex = -1;  break;  // does not exist!

                    case 148:  iIndex = -1;  break;  // does not exist!

                    case 149:  iIndex = -1;  break;  // does not exist!

                    case 150:  iIndex = -1;  break;  // does not exist!

                    case 151:  iIndex = -1;  break;  // does not exist!

                    case 152:  iIndex = -1;  break;  // does not exist!

                    case 153:  iIndex = -1;  break;  // does not exist!

                    case 154:  iIndex = -1;  break;  // does not exist!

                    case 155:  iIndex = -1;  break;  // does not exist!

                    case 156:  iIndex = -1;  break;  // does not exist!

                    case 157:  iIndex = -1;  break;  // does not exist!

                    case 158:  iIndex = -1;  break;  // does not exist!

                    case 159:  iIndex = -1;  break;  // does not exist!

                    case 160:  iIndex = -1;  break;  // does not exist!

                    case 164:  iIndex = 0;  break;   // fraction "/"

                    case 166:  iIndex = 0;  break;   // florin

                    case 168:  iIndex = 164;  break; // currency "¤"

                    case 169:  iIndex = 39;  break;  // quotesingle "'"

                    case 170:  iIndex = 0;  break;   // quotedblleft

                    case 172:  iIndex = 0;  break;   // guilsinglleft

                    case 173:  iIndex = 0;  break;   // guilsinglright

                    case 174:  iIndex = 0;  break;   // fi

                    case 175:  iIndex = 0;  break;   // fl

                    case 176:  iIndex = -1;  break;  // does not exist!

                    case 177:  iIndex = 0;  break;   // endash "-"

                    case 178:  iIndex = 0;  break;   // dagger

                    case 179:  iIndex = 0;  break;   // daggerdbl

                    case 180:  iIndex = 183;  break; // periodcentered

                    case 183:  iIndex = 0;  break;   // bullet

                    case 184:  iIndex = 0;  break;   // quotesinglbase

                    case 185:  iIndex = 0;  break;   // quotedblbase

                    case 186:  iIndex = 0;  break;   // quotedblright

                    case 188:  iIndex = 0;  break;   // ellipsis

                    case 189:  iIndex = 0;  break;   // perthousand

                    case 190:  iIndex = -1;  break;  // does not exist!

                    case 192:  iIndex = -1;  break;  // does not exist!

                    case 193:  iIndex = 96;  break;  // grave "`"

                    case 194:  iIndex = 180;  break; // acute "´"

                    case 195:  iIndex = 0;  break;   // circumflex "^"

                    case 196:  iIndex = 0;  break;   // tilde "~"

                    case 197:  iIndex = 175;  break; // macron

                    case 198:  iIndex = 0;  break;   // breve

                    case 199:  iIndex = 0;  break;   // dotaccent

                    case 200:  iIndex = 168;  break; // dieresis "¨"

                    case 201:  iIndex = -1;  break;  // does not exist!

                    case 202:  iIndex = 0;  break;   // ring

                    case 203:  iIndex = 184;  break; // cedilla "¨"

                    case 204:  iIndex = -1;  break;  // does not exist!

                    case 205:  iIndex = 0;  break;   // hungarumlaut

                    case 206:  iIndex = 0;  break;   // ogonek

                    case 207:  iIndex = 0;  break;   // caron

                    case 208:  iIndex = 0;  break;   // emdash

                    case 209:  iIndex = -1;  break;  // does not exist!

                    case 210:  iIndex = -1;  break;  // does not exist!

                    case 211:  iIndex = -1;  break;  // does not exist!

                    case 212:  iIndex = -1;  break;  // does not exist!

                    case 213:  iIndex = -1;  break;  // does not exist!

                    case 214:  iIndex = -1;  break;  // does not exist!

                    case 215:  iIndex = -1;  break;  // does not exist!

                    case 216:  iIndex = -1;  break;  // does not exist!

                    case 217:  iIndex = -1;  break;  // does not exist!

                    case 218:  iIndex = -1;  break;  // does not exist!

                    case 219:  iIndex = -1;  break;  // does not exist!

                    case 220:  iIndex = -1;  break;  // does not exist!

                    case 221:  iIndex = -1;  break;  // does not exist!

                    case 222:  iIndex = -1;  break;  // does not exist!

                    case 223:  iIndex = -1;  break;  // does not exist!

                    case 224:  iIndex = -1;  break;  // does not exist!

                    case 225:  iIndex = 198;  break; // AE

                    case 226:  iIndex = -1;  break;  // does not exist!

                    case 227:  iIndex = 170;  break; // ordfeminine

                    case 228:  iIndex = -1;  break;  // does not exist!

                    case 229:  iIndex = -1;  break;  // does not exist!

                    case 230:  iIndex = -1;  break;  // does not exist!

                    case 231:  iIndex = -1;  break;  // does not exist!

                    case 232:  iIndex = 0;  break;   // Lslash

                    case 233:  iIndex = 216;  break; // Oslash

                    case 234:  iIndex = 0;  break;   // OE

                    case 235:  iIndex = 186;  break; // ordmasculine

                    case 236:  iIndex = -1;  break;  // does not exist!

                    case 237:  iIndex = -1;  break;  // does not exist!

                    case 238:  iIndex = -1;  break;  // does not exist!

                    case 239:  iIndex = -1;  break;  // does not exist!

                    case 240:  iIndex = -1;  break;  // does not exist!

                    case 241:  iIndex = 230;  break; // ae

                    case 242:  iIndex = -1;  break;  // does not exist!

                    case 243:  iIndex = -1;  break;  // does not exist!

                    case 244:  iIndex = -1;  break;  // does not exist!

                    case 245:  iIndex = 0;  break;   // dotlessi

                    case 246:  iIndex = -1;  break;  // does not exist!

                    case 247:  iIndex = -1;  break;  // does not exist!

                    case 248:  iIndex = 0;  break;   // lslash

                    case 249:  iIndex = 248;  break; // oslash

                    case 250:  iIndex = 0;  break;   // oe

                    case 251:  iIndex = 223;  break; // germandbls

                    case -1: {
                        switch (sName)
                        {
                        case "brokenbar":      iIndex = 166;  break;

                        case "copyright":      iIndex = 169;  break;

                        case "logicalnot":     iIndex = 172;  break;

                        case "registered":     iIndex = 174;  break;

                        case "degree":         iIndex = 176;  break;

                        case "plusminus":      iIndex = 177;  break;

                        case "twosuperior":    iIndex = 178;  break;

                        case "threesuperior":  iIndex = 179;  break;

                        case "mu":             iIndex = 181;  break;

                        case "onesuperior":    iIndex = 185;  break;

                        case "onequarter":     iIndex = 188;  break;

                        case "onehalf":        iIndex = 189;  break;

                        case "threequarters":  iIndex = 190;  break;

                        case "Agrave":         iIndex = 192;  break;

                        case "Aacute":         iIndex = 193;  break;

                        case "Acircumflex":    iIndex = 194;  break;

                        case "Atilde":         iIndex = 195;  break;

                        case "Adieresis":      iIndex = 196;  break;

                        case "Aring":          iIndex = 197;  break;

                        case "Ccedilla":       iIndex = 199;  break;

                        case "Egrave":         iIndex = 200;  break;

                        case "Eacute":         iIndex = 201;  break;

                        case "Ecircumflex":    iIndex = 202;  break;

                        case "Edieresis":      iIndex = 203;  break;

                        case "Igrave":         iIndex = 204;  break;

                        case "Iacute":         iIndex = 205;  break;

                        case "Icircumflex":    iIndex = 206;  break;

                        case "Idieresis":      iIndex = 207;  break;

                        case "Eth":            iIndex = 208;  break;

                        case "Ntilde":         iIndex = 209;  break;

                        case "Ograve":         iIndex = 210;  break;

                        case "Oacute":         iIndex = 211;  break;

                        case "Ocircumflex":    iIndex = 212;  break;

                        case "Otilde":         iIndex = 213;  break;

                        case "Odieresis":      iIndex = 214;  break;

                        case "multiply":       iIndex = 215;  break;

                        case "Ugrave":         iIndex = 217;  break;

                        case "Uacute":         iIndex = 218;  break;

                        case "Ucircumflex":    iIndex = 219;  break;

                        case "Udieresis":      iIndex = 220;  break;

                        case "Yacute":         iIndex = 221;  break;

                        case "Thorn":          iIndex = 222;  break;

                        case "agrave":         iIndex = 224;  break;

                        case "aacute":         iIndex = 225;  break;

                        case "acircumflex":    iIndex = 226;  break;

                        case "atilde":         iIndex = 227;  break;

                        case "adieresis":      iIndex = 228;  break;

                        case "aring":          iIndex = 229;  break;

                        case "ccedilla":       iIndex = 231;  break;

                        case "egrave":         iIndex = 232;  break;

                        case "eacute":         iIndex = 233;  break;

                        case "ecircumflex":    iIndex = 234;  break;

                        case "edieresis":      iIndex = 235;  break;

                        case "igrave":         iIndex = 236;  break;

                        case "iacute":         iIndex = 237;  break;

                        case "icircumflex":    iIndex = 238;  break;

                        case "idieresis":      iIndex = 239;  break;

                        case "eth":            iIndex = 240;  break;

                        case "ntilde":         iIndex = 241;  break;

                        case "ograve":         iIndex = 242;  break;

                        case "oacute":         iIndex = 243;  break;

                        case "ocircumflex":    iIndex = 244;  break;

                        case "otilde":         iIndex = 245;  break;

                        case "odieresis":      iIndex = 246;  break;

                        case "divide":         iIndex = 247;  break;

                        case "ugrave":         iIndex = 249;  break;

                        case "uacute":         iIndex = 250;  break;

                        case "ucircumflex":    iIndex = 251;  break;

                        case "udieresis":      iIndex = 252;  break;

                        case "yacute":         iIndex = 253;  break;

                        case "thorn":          iIndex = 254;  break;

                        case "ydieresis":      iIndex = 255;  break;

                        case "Amacron":        iIndex = 256;  break;

                        case "Abreve":         iIndex = 258;  break;

                        case "abreve":         iIndex = 259;  break;

                        case "Aogonek":        iIndex = 260;  break;

                        case "aogonek":        iIndex = 261;  break;

                        case "Cacute":         iIndex = 262;  break;

                        case "cacute":         iIndex = 263;  break;

                        case "Ccaron":         iIndex = 268;  break;

                        case "ccaron":         iIndex = 269;  break;

                        case "Dcaron":         iIndex = 270;  break;

                        case "dcaron":         iIndex = 271;  break;

                        case "Dcroat":         iIndex = 272;  break;

                        case "dcroat":         iIndex = 273;  break;

                        case "Emacron":        iIndex = 274;  break;

                        case "emacron":        iIndex = 275;  break;

                        case "Edotaccent":     iIndex = 278;  break;

                        case "edotaccent":     iIndex = 279;  break;

                        case "Eogonek":        iIndex = 280;  break;

                        case "eogonek":        iIndex = 281;  break;

                        case "Ecaron":         iIndex = 282;  break;

                        case "ecaron":         iIndex = 283;  break;

                        case "Gbreve":         iIndex = 286;  break;

                        case "gbreve":         iIndex = 287;  break;

                        case "Gcommaaccent":   iIndex = 290;  break;

                        case "gcommaaccent":   iIndex = 291;  break;

                        case "Imacron":        iIndex = 298;  break;

                        case "imacron":        iIndex = 299;  break;

                        case "Euro":           iIndex = 128;  break;

                        default: {
                            iIndex = 0;
                            break;
                        }
                        }
                        break;
                    }
                    }
                }
                if (iIndex > 0)
                {
                    type1FontData.aCharMetrics[iIndex] = this;
                }
            }
Exemple #2
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary></summary>
 /// <param name="sKey"></param>
 /// <param name="afm"></param>
 public PdfFontPropData(String sKey, Type1FontData afm)
 {
     this.sKey = sKey;
     this.afm  = afm;
     Init();
 }