コード例 #1
0
ファイル: Analyzer.cs プロジェクト: fealty/Typesetting
        /// <summary>
        ///   This method performs an analysis of the prepared text.
        /// </summary>
        /// <param name="formatter"> This parameter references the output sink where results are stored. </param>
        public void Analyze(Aggregator formatter)
        {
            Contract.Requires(formatter != null);

            formatter.BeginAggregation(_FullText);

            try
            {
                if(_TextAnalyzer.AnalyzeLineBreakpoints(this, 0, _FullText.Length, formatter).Failure)
                {
                    throw new InvalidOperationException("Analysis of line breaking points failed!");
                }

                if(_TextAnalyzer.AnalyzeBidi(this, 0, _FullText.Length, formatter).Failure)
                {
                    throw new InvalidOperationException("Analysis of bidi-text failed!");
                }

                if(_TextAnalyzer.AnalyzeScript(this, 0, _FullText.Length, formatter).Failure)
                {
                    throw new InvalidOperationException("Analysis of scripts failed!");
                }

                if(_TextAnalyzer.AnalyzeNumberSubstitution(this, 0, _FullText.Length, formatter).Failure)
                {
                    throw new InvalidOperationException("Analysis of number substition failed!");
                }
            }
            catch(SharpDXException e)
            {
                throw new InvalidOperationException(e.Message, e);
            }
        }
コード例 #2
0
ファイル: TextPipeline.cs プロジェクト: fealty/Typesetting
        public TextPipeline(FontDevice fontDevice)
        {
            Contract.Requires(fontDevice != null);

            _FontDevice = fontDevice;

            _TextAnalyzer = new Analyzer(_FontDevice.Factory);
            _AggregatorSink = new AggregatorSink();
            _Aggregator = new Aggregator(_AggregatorSink);
            _ShaperSink = new ShaperSink();
            _Shaper = new Shaper(_FontDevice, _ShaperSink);
            _FormatterSink = new FormatterSink();
            _Formatter = new Formatter(_FormatterSink);
            _TypesetterSink = new TypesetterSink();
            _Typesetter = new Typesetter(_TypesetterSink);
            _GeometryCache = new TextGeometryCache();
        }