Beispiel #1
0
 /// <summary>
 /// Add elements from a given dict to this dict
 /// </summary>
 /// <param name="dict"></param>
 public void Add(EpsDictionary dict)
 {
     foreach (var kv in dict.list)
     {
         list.Add(kv);
     }
 }
        /// <summary>
        /// Define a resource
        /// </summary>
        public void DefineResource(string category, Operand key, Operand resource)
        {
            EpsDictionary categoryDict;

            if (!categories.TryGetValue(category, out categoryDict))
            {
                categoryDict = new EpsDictionary();
                categories.Add(category, categoryDict);
            }

            categoryDict.Add(key, resource);
        }
Beispiel #3
0
        /// <summary>
        /// Prepare dictionaries
        /// </summary>
        private void PrepareStandardDictionaries(int postscriptVersion)
        {
            ResourceManager = new ResourceManager();
            ResourceManager.DefineResource("Category", new NameOperand("Generic"), new DictionaryOperand());

            DictionaryStack = new EpsStack <EpsDictionary>();
            SystemDict      = new EpsDictionary {
                IsPermanent = true
            };
            GlobalDict = new EpsDictionary {
                IsPermanent = true
            };
            UserDict = new EpsDictionary {
                IsPermanent = true
            };
            ErrorDict = new EpsDictionary {
                IsPermanent = true
            };
            DollarErrordict = new EpsDictionary {
                IsPermanent = true
            };
            statusDict = new EpsDictionary {
                IsPermanent = true
            };
            fontDict = new EpsDictionary {
                IsPermanent = true
            };

            DictionaryStack.Push(SystemDict);
            DictionaryStack.Push(GlobalDict);
            DictionaryStack.Push(UserDict);

            var systemDict = SystemDict;

            var     name    = new NameOperand("systemdict");
            Operand operand = new DictionaryOperand(SystemDict);

            systemDict.Add(name, operand);

            name    = new NameOperand("userdict");
            operand = new DictionaryOperand(UserDict);
            systemDict.Add(name, operand);

            name    = new NameOperand("globaldict");
            operand = new DictionaryOperand(GlobalDict);
            systemDict.Add(name, operand);

            name    = new NameOperand("statusdict");
            operand = new DictionaryOperand(statusDict);
            systemDict.Add(name, operand);

            name    = new NameOperand("errordict");
            operand = new DictionaryOperand(ErrorDict);
            systemDict.Add(name, operand);

            name    = new NameOperand("$error");
            operand = new DictionaryOperand(DollarErrordict);
            systemDict.Add(name, operand);

            name    = new NameOperand("GlobalFontDirectory");
            operand = new DictionaryOperand(fontDict);
            systemDict.Add(name, operand);

            name    = new NameOperand("SharedFontDirectory");
            operand = new DictionaryOperand(fontDict);
            systemDict.Add(name, operand);

            name    = new NameOperand("true");
            operand = new BooleanOperand(true);
            systemDict.Add(name, operand);

            name    = new NameOperand("false");
            operand = new BooleanOperand(false);
            systemDict.Add(name, operand);

            name    = new NameOperand("null");
            operand = new NullOperand();
            systemDict.Add(name, operand);

            // for level 1 do not create this name, some adobe scripts
            // assume level 2 or higher just based on the existence of the name

            if (postscriptVersion >= 2)
            {
                name    = new NameOperand("languagelevel");
                operand = new IntegerOperand(postscriptVersion);
                systemDict.Add(name, operand);
            }

            name = new NameOperand("newerror");
            var b = new BooleanOperand(false);

            DollarErrordict.Add(name, b);
        }