Example #1
0
			internal void Reset()
			{
				_Runs.Clear();
				_States.Clear();

				_Alignment = Alignment.Stretch;
				_Indentation = DefaultIndentation;
				_Leading = DefaultLeading;
				_Spacing = DefaultSpacing;
				_Tracking = DefaultTracking;

				_Text.Clear();

				_ActiveCulture = DefaultCulture;
				_ActiveFamily = DefaultFamily;
				_ActivePointSize = DefaultPointSize;
				_ActiveHAlignment = Alignment.Stretch;
				_ActiveVAlignment = Alignment.Stretch;
				_ActiveInline = Size.Empty;
				_ActiveTextRange = IndexedRange.Empty;
				_ActiveStretch = FontStretch.Regular;
				_ActiveStyle = FontStyle.Regular;
				_ActiveWeight = FontWeight.Regular;
				_ActiveFeatures = null;
			}
Example #2
0
			public Builder WithFeatures(FontFeatureCollection features)
			{
				Contract.Ensures(Contract.Result<Builder>() != null);

				_ActiveFeatures = features;

				return this;
			}
Example #3
0
			public Builder ResetState()
			{
				Contract.Ensures(Contract.Result<Builder>() != null);

				_ActiveTextRange = IndexedRange.Empty;
				_ActiveCulture = DefaultCulture;
				_ActiveFamily = DefaultFamily;
				_ActiveFeatures = null;
				_ActivePointSize = DefaultPointSize;
				_ActiveStretch = FontStretch.Regular;
				_ActiveStyle = FontStyle.Regular;
				_ActiveWeight = FontWeight.Regular;
				_ActiveInline = Size.Empty;
				_ActiveHAlignment = Alignment.Stretch;
				_ActiveVAlignment = Alignment.Stretch;

				return this;
			}
Example #4
0
			public Builder RestoreState()
			{
				Contract.Ensures(Contract.Result<Builder>() != null);

				TextRun activeState = _States.Pop();

				_ActiveTextRange = activeState.TextRange;
				_ActiveCulture = activeState.Culture;
				_ActiveFamily = activeState.Family;
				_ActiveFeatures = activeState.Features;
				_ActivePointSize = activeState.PointSize;
				_ActiveStretch = activeState.Stretch;
				_ActiveStyle = activeState.Style;
				_ActiveWeight = activeState.Weight;
				_ActiveInline = activeState.Inline;
				_ActiveHAlignment = activeState.HAlignment;
				_ActiveVAlignment = activeState.VAlignment;

				return this;
			}
Example #5
0
        /// <summary>
        ///   This method applies the given font features to a range of characters.
        /// </summary>
        /// <param name="textRange"> This parameter indicates the range of characters to modify. </param>
        /// <param name="features"> This parameter references the collection of font features to apply to the range. </param>
        public void SetFeatures(IndexedRange textRange, FontFeatureCollection features)
        {
            Contract.Assert(textRange.IsWithin(_OutputSink.FullText));

            foreach(int index in textRange)
            {
                _OutputSink.Characters[index].Features = features;
            }
        }