// Token: 0x060066A0 RID: 26272 RVA: 0x001CCD18 File Offset: 0x001CAF18 private void InitCommon(DependencyObject target) { this._typeface = DynamicPropertyReader.GetTypeface(target); this._fontSize = (double)target.GetValue(TextElement.FontSizeProperty); this._foreground = (Brush)target.GetValue(TextElement.ForegroundProperty); this._textEffects = DynamicPropertyReader.GetTextEffects(target); this._cultureInfo = DynamicPropertyReader.GetCultureInfo(target); this._textDecorations = DynamicPropertyReader.GetTextDecorations(target); if (this._numberSubstitution == null) { this._numberSubstitution = DynamicPropertyReader.GetNumberSubstitution(target); } }
// assigns values to all fields except for _typographyProperties, _baselineAlignment, // and _background, which are set appropriately in each constructor private void InitCommon(DependencyObject target) { _typeface = DynamicPropertyReader.GetTypeface(target); _fontSize = (double)target.GetValue(TextElement.FontSizeProperty); _foreground = (Brush)target.GetValue(TextElement.ForegroundProperty); _textEffects = DynamicPropertyReader.GetTextEffects(target); _cultureInfo = DynamicPropertyReader.GetCultureInfo(target); _textDecorations = DynamicPropertyReader.GetTextDecorations(target); // as an optimization, we may have already initialized _numberSubstitution to a default // value if none of the NumberSubstitution dependency properties have changed if (_numberSubstitution == null) { _numberSubstitution = DynamicPropertyReader.GetNumberSubstitution(target); } }
// Token: 0x06006600 RID: 26112 RVA: 0x001CAB08 File Offset: 0x001C8D08 public override TextSpan <CultureSpecificCharacterBufferRange> GetPrecedingText(int dcp) { int num = 0; CharacterBufferRange empty = CharacterBufferRange.Empty; CultureInfo culture = null; if (dcp > 0) { ITextPointer textPointer = this._owner.TextContainer.CreatePointerAtOffset(dcp, LogicalDirection.Backward); while (textPointer.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text && textPointer.CompareTo(this._owner.TextContainer.Start) != 0) { textPointer.MoveByOffset(-1); num++; } string textInRun = textPointer.GetTextInRun(LogicalDirection.Backward); empty = new CharacterBufferRange(textInRun, 0, textInRun.Length); StaticTextPointer staticTextPointer = textPointer.CreateStaticPointer(); DependencyObject element = (staticTextPointer.Parent != null) ? staticTextPointer.Parent : this._owner; culture = DynamicPropertyReader.GetCultureInfo(element); } return(new TextSpan <CultureSpecificCharacterBufferRange>(num + empty.Length, new CultureSpecificCharacterBufferRange(culture, empty))); }
// ------------------------------------------------------------------ // Get text immediately before specified text source position. // ------------------------------------------------------------------ public override TextSpan <CultureSpecificCharacterBufferRange> GetPrecedingText(int dcp) { // Parameter validation Debug.Assert(dcp >= 0); int nonTextLength = 0; CharacterBufferRange precedingText = CharacterBufferRange.Empty; CultureInfo culture = null; if (dcp > 0) { // Create TextPointer at dcp ITextPointer position = _owner.TextContainer.CreatePointerAtOffset(dcp, LogicalDirection.Backward); // Move backward until we find a position at the end of a text run, or reach start of TextContainer while (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text && position.CompareTo(_owner.TextContainer.Start) != 0) { position.MoveByOffset(-1); nonTextLength++; } // Return text in run. If it is at start of TextContainer this will return an empty string string precedingTextString = position.GetTextInRun(LogicalDirection.Backward); precedingText = new CharacterBufferRange(precedingTextString, 0, precedingTextString.Length); StaticTextPointer pointer = position.CreateStaticPointer(); DependencyObject element = (pointer.Parent != null) ? pointer.Parent : _owner; culture = DynamicPropertyReader.GetCultureInfo(element); } return(new TextSpan <CultureSpecificCharacterBufferRange>( nonTextLength + precedingText.Length, new CultureSpecificCharacterBufferRange(culture, precedingText) )); }