// Token: 0x0600660E RID: 26126 RVA: 0x001CB324 File Offset: 0x001C9524 internal static TextDecorationCollection GetTextDecorationsForInlineObject(DependencyObject element, TextDecorationCollection textDecorations) { DependencyObject parent = LogicalTreeHelper.GetParent(element); TextDecorationCollection textDecorationCollection = null; if (parent != null) { textDecorationCollection = DynamicPropertyReader.GetTextDecorations(parent); } if (!((textDecorations == null) ? (textDecorationCollection == null) : textDecorations.ValueEquals(textDecorationCollection))) { if (textDecorationCollection == null) { textDecorations = null; } else { textDecorations = new TextDecorationCollection(); int count = textDecorationCollection.Count; for (int i = 0; i < count; i++) { textDecorations.Add(textDecorationCollection[i]); } } } return(textDecorations); }
// Token: 0x06006607 RID: 26119 RVA: 0x001CB000 File Offset: 0x001C9200 private TextRun HandleElementStartEdge(StaticTextPointer position) { TextElement textElement = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward); TextRun result; if (textElement is LineBreak) { result = new TextEndOfLine(ComplexLine._elementEdgeCharacterLength * 2); } else if (textElement.IsEmpty) { TextRunProperties textRunProperties = new TextProperties(textElement, position, false, true, base.PixelsPerDip); char[] array = new char[ComplexLine._elementEdgeCharacterLength * 2]; array[0] = ''; array[1] = ''; result = new TextCharacters(array, 0, array.Length, textRunProperties); } else { Inline inline = textElement as Inline; if (inline == null) { result = new TextHidden(ComplexLine._elementEdgeCharacterLength); } else { DependencyObject parent = inline.Parent; FlowDirection flowDirection = inline.FlowDirection; FlowDirection flowDirection2 = flowDirection; if (parent != null) { flowDirection2 = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty); } TextDecorationCollection textDecorations = DynamicPropertyReader.GetTextDecorations(inline); if (flowDirection != flowDirection2) { if (textDecorations == null || textDecorations.Count == 0) { result = new TextSpanModifier(ComplexLine._elementEdgeCharacterLength, null, null, flowDirection); } else { result = new TextSpanModifier(ComplexLine._elementEdgeCharacterLength, textDecorations, inline.Foreground, flowDirection); } } else if (textDecorations == null || textDecorations.Count == 0) { result = new TextHidden(ComplexLine._elementEdgeCharacterLength); } else { result = new TextSpanModifier(ComplexLine._elementEdgeCharacterLength, textDecorations, inline.Foreground); } } } return(result); }
// 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); } }
// ------------------------------------------------------------------ // Fetch the next run at element close edge position. // // position - current position in the text array // ------------------------------------------------------------------ private TextRun HandleElementEndEdge(StaticTextPointer position) { Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd, "TextPointer does not point to element end edge."); TextRun run = null; TextElement element = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward); Debug.Assert(element != null, "Element should be here."); Inline inline = element as Inline; if (inline == null) { run = new TextHidden(_elementEdgeCharacterLength); } else { DependencyObject parent = inline.Parent; FlowDirection parentFlowDirection = inline.FlowDirection; if (parent != null) { parentFlowDirection = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty); } if (inline.FlowDirection != parentFlowDirection) { run = new TextEndOfSegment(_elementEdgeCharacterLength); } else { TextDecorationCollection textDecorations = DynamicPropertyReader.GetTextDecorations(inline); if (textDecorations == null || textDecorations.Count == 0) { // (2) End of inline element, hide CloseEdge character and continue run = new TextHidden(_elementEdgeCharacterLength); } else { run = new TextEndOfSegment(_elementEdgeCharacterLength); } } } return(run); }
// 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: 0x06006608 RID: 26120 RVA: 0x001CB13C File Offset: 0x001C933C private TextRun HandleElementEndEdge(StaticTextPointer position) { TextElement textElement = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward); Inline inline = textElement as Inline; TextRun result; if (inline == null) { result = new TextHidden(ComplexLine._elementEdgeCharacterLength); } else { DependencyObject parent = inline.Parent; FlowDirection flowDirection = inline.FlowDirection; if (parent != null) { flowDirection = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty); } if (inline.FlowDirection != flowDirection) { result = new TextEndOfSegment(ComplexLine._elementEdgeCharacterLength); } else { TextDecorationCollection textDecorations = DynamicPropertyReader.GetTextDecorations(inline); if (textDecorations == null || textDecorations.Count == 0) { result = new TextHidden(ComplexLine._elementEdgeCharacterLength); } else { result = new TextEndOfSegment(ComplexLine._elementEdgeCharacterLength); } } } return(result); }
// ------------------------------------------------------------------ // Fetch the next run at element open edge position. // // position - current position in the text array // ------------------------------------------------------------------ private TextRun HandleElementStartEdge(StaticTextPointer position) { Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart, "TextPointer does not point to element start edge."); // TextRun run = null; TextElement element = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward); Debug.Assert(element != null, "Cannot use ITextContainer that does not provide TextElement instances."); if (element is LineBreak) { run = new TextEndOfLine(_elementEdgeCharacterLength * 2); } else if (element.IsEmpty) { // Empty TextElement should affect line metrics. // TextFormatter does not support this feature right now, so as workaround // TextRun with ZERO WIDTH SPACE is used. TextRunProperties textProps = new TextProperties(element, position, false /* inline objects */, true /* get background */); char[] textBuffer = new char[_elementEdgeCharacterLength * 2]; textBuffer[0] = (char)0x200B; textBuffer[1] = (char)0x200B; run = new TextCharacters(textBuffer, 0, textBuffer.Length, textProps); } else { Inline inline = element as Inline; if (inline == null) { run = new TextHidden(_elementEdgeCharacterLength); } else { DependencyObject parent = inline.Parent; FlowDirection inlineFlowDirection = inline.FlowDirection; FlowDirection parentFlowDirection = inlineFlowDirection; if (parent != null) { parentFlowDirection = (FlowDirection)parent.GetValue(FrameworkElement.FlowDirectionProperty); } TextDecorationCollection inlineTextDecorations = DynamicPropertyReader.GetTextDecorations(inline); if (inlineFlowDirection != parentFlowDirection) { // Inline's flow direction is different from its parent. Need to create new TextSpanModifier with flow direction if (inlineTextDecorations == null || inlineTextDecorations.Count == 0) { run = new TextSpanModifier( _elementEdgeCharacterLength, null, null, inlineFlowDirection ); } else { run = new TextSpanModifier( _elementEdgeCharacterLength, inlineTextDecorations, inline.Foreground, inlineFlowDirection ); } } else { if (inlineTextDecorations == null || inlineTextDecorations.Count == 0) { run = new TextHidden(_elementEdgeCharacterLength); } else { run = new TextSpanModifier( _elementEdgeCharacterLength, inlineTextDecorations, inline.Foreground ); } } } } return(run); }