예제 #1
0
        public void initDefault()
        {
            // Dispose if not null
            if (_package != null)
            {
                _package.Dispose(); _package = null;
            }
            if (_part != null)
            {
                _part.Dispose(); _part = null;
            }
            if (_editor != null)
            {
                _editor.Dispose(); _editor = null;
            }
            if (_renderer != null)
            {
                _renderer.Dispose(); _renderer = null;
            }
            if (_engine != null)
            {
                _engine.Dispose(); _engine = null;
            }

            _engine = Engine.Create(MyScript.Certificate.MyCertificate.Bytes);
            var confDirs = new string[1];

            confDirs[0] = "conf";
            _engine.Configuration.SetStringArray("configuration-manager.search-path", confDirs);

            var localFolder = _path;
            var tempFolder  = _tmp_path;

            _engine.Configuration.SetString("content-package.temp-folder", tempFolder);

            _engine.Configuration.SetString("lang", _lang);

            _dpiX     = 300;
            _dpiY     = 300;
            _renderer = _engine.CreateRenderer(_dpiX, _dpiY, null);

            _package = _engine.CreatePackage("text.iink");
            _part    = _package.CreatePart("Text");

            _editor       = _engine.CreateEditor(_renderer);
            _editor.Theme = ".text { font-size: 7.8;line-height: 1.0; }";
            _editor.SetViewSize(30000, 30000);
            var fmp = new FontMetricsProvider(_dpiX, _dpiY);

            _editor.SetFontMetricsProvider(fmp);

            _editor.Part = _part;

            _editor.Configuration.SetBoolean("text.guides.enable", false);
            _engine.Configuration.SetBoolean("text.guides.enable", false);

            initListener();
        }