예제 #1
0
 private void ParseCIDRange(CMap codes, IList <object> operands)
 {
     for (int itemIndex = 0, itemCount = (int)operands[0]; itemIndex < itemCount; itemIndex++)
     {
         // 1. Beginning input code.
         MoveNext();
         byte[] beginInputCode = ParseInputCode();
         int    beginInput     = ConvertUtils.ByteArrayToInt(beginInputCode);
         // 2. Ending input code.
         MoveNext();
         byte[] endInputCode = ParseInputCode();
         int    entInput     = ConvertUtils.ByteArrayToInt(endInputCode);
         MoveNext();
         int mappedCode = ParseUnicode();
         // 3. Character codes.
         if (beginInputCode.Length <= 2 && endInputCode.Length <= 2)
         {
             // some CMaps are using CID ranges to map single values
             if (beginInput == entInput)
             {
                 codes.AddCIDMapping(mappedCode, beginInput);
             }
             else
             {
                 codes.AddCIDRange((char)beginInput, (char)entInput, mappedCode);
             }
         }
         else
         {
             // TODO Is this even possible?
             int endOfMappings = mappedCode + entInput - beginInput;
             while (mappedCode <= endOfMappings)
             {
                 int mappedCID = ConvertUtils.ByteArrayToInt(beginInputCode);
                 codes.AddCIDMapping(mappedCode++, mappedCID);
                 OperationUtils.Increment(beginInputCode);
             }
         }
     }
 }
예제 #2
0
        private void ParseCIDChar(CMap codes, IList <object> operands)
        {
            for (int itemIndex = 0, itemCount = (int)operands[0]; itemIndex < itemCount; itemIndex++)
            {
                MoveNext();
                var inputCode = ParseInputCode();
                int mappedCID = ConvertUtils.ByteArrayToInt(inputCode);
                MoveNext();
                var mappedCode = ParseUnicode();

                codes.AddCIDMapping(mappedCode, mappedCID);
            }
        }