Ejemplo n.º 1
0
 private void LoadCMaps()
 {
     try {
         fontDesc = allFonts[fontName];
         hMetrics = (IntHashtable)fontDesc["W"];
         vMetrics = (IntHashtable)fontDesc["W2"];
         String registry = (String)fontDesc["Registry"];
         uniMap = "";
         foreach (String name in registryNames[registry + "_Uni"].Keys)
         {
             uniMap = name;
             if (name.EndsWith("V") && vertical)
             {
                 break;
             }
             if (!name.EndsWith("V") && !vertical)
             {
                 break;
             }
         }
         if (cidDirect)
         {
             cidUni = CMapCache.GetCachedCMapCidUni(uniMap);
         }
         else
         {
             uniCid  = CMapCache.GetCachedCMapUniCid(uniMap);
             cidByte = CMapCache.GetCachedCMapCidByte(CMap);
         }
     }
     catch (Exception ex) {
         throw new DocumentException(ex.Message);
     }
 }
Ejemplo n.º 2
0
 public CMapEncoding(String cmap, byte[] cmapBytes)
 {
     this.cmap = cmap;
     cid2Code  = new CMapCidByte();
     try {
         CMapParser.ParseCid(cmap, cid2Code, new CMapLocationFromBytes(cmapBytes));
         code2Cid             = cid2Code.GetReversMap();
         this.codeSpaceRanges = cid2Code.GetCodeSpaceRanges();
     }
     catch (System.IO.IOException) {
         LogManager.GetLogger(GetType()).Error(iText.IO.LogMessageConstant.FAILED_TO_PARSE_ENCODING_STREAM);
     }
 }
Ejemplo n.º 3
0
 /// <param name="cmap">CMap name.</param>
 /// <param name="uniMap">CMap to convert Unicode value to CID.</param>
 public CMapEncoding(String cmap, String uniMap)
 {
     this.cmap   = cmap;
     this.uniMap = uniMap;
     if (cmap.Equals(PdfEncodings.IDENTITY_H) || cmap.Equals(PdfEncodings.IDENTITY_V))
     {
         cid2Uni  = FontCache.GetCid2UniCmap(uniMap);
         isDirect = true;
     }
     else
     {
         cid2Code = FontCache.GetCid2Byte(cmap);
         code2Cid = cid2Code.GetReversMap();
     }
 }
Ejemplo n.º 4
0
        public static CMapCidByte GetCid2Byte(String cmap)
        {
            CMapCidByte cidByte = new CMapCidByte();

            return(ParseCmap(cmap, cidByte));
        }