Beispiel #1
0
        internal TextProperties(DependencyObject target, StaticTextPointer position, bool inlineObjects, bool getBackground, double pixelsPerDip)
        {
            // if none of the number substitution properties have changed, we may be able to
            // initialize the _numberSubstitution field to a known default value
            FrameworkContentElement fce = target as FrameworkContentElement;

            if (fce != null)
            {
                if (!fce.HasNumberSubstitutionChanged)
                {
                    _numberSubstitution = FrameworkContentElement.DefaultNumberSubstitution;
                }
            }
            else
            {
                FrameworkElement fe = target as FrameworkElement;
                if (fe != null && !fe.HasNumberSubstitutionChanged)
                {
                    _numberSubstitution = FrameworkElement.DefaultNumberSubstitution;
                }
            }

            PixelsPerDip = pixelsPerDip;
            InitCommon(target);

            _typographyProperties = GetTypographyProperties(target);
            if (!inlineObjects)
            {
                _baselineAlignment = DynamicPropertyReader.GetBaselineAlignment(target);

                if (!position.IsNull)
                {
                    TextDecorationCollection highlightDecorations = GetHighlightTextDecorations(position);
                    if (highlightDecorations != null)
                    {
                        // Highlights (if present) take precedence over property value TextDecorations.
                        _textDecorations = highlightDecorations;
                    }
                }

                if (getBackground)
                {
                    _backgroundBrush = DynamicPropertyReader.GetBackgroundBrush(target);
                }
            }
            else
            {
                _baselineAlignment = DynamicPropertyReader.GetBaselineAlignmentForInlineObject(target);
                _textDecorations   = DynamicPropertyReader.GetTextDecorationsForInlineObject(target, _textDecorations);

                if (getBackground)
                {
                    _backgroundBrush = DynamicPropertyReader.GetBackgroundBrushForInlineObject(position);
                }
            }
        }
        // Token: 0x0600669E RID: 26270 RVA: 0x001CCBB0 File Offset: 0x001CADB0
        internal TextProperties(DependencyObject target, StaticTextPointer position, bool inlineObjects, bool getBackground, double pixelsPerDip)
        {
            FrameworkContentElement frameworkContentElement = target as FrameworkContentElement;

            if (frameworkContentElement != null)
            {
                if (!frameworkContentElement.HasNumberSubstitutionChanged)
                {
                    this._numberSubstitution = FrameworkContentElement.DefaultNumberSubstitution;
                }
            }
            else
            {
                FrameworkElement frameworkElement = target as FrameworkElement;
                if (frameworkElement != null && !frameworkElement.HasNumberSubstitutionChanged)
                {
                    this._numberSubstitution = FrameworkElement.DefaultNumberSubstitution;
                }
            }
            base.PixelsPerDip = pixelsPerDip;
            this.InitCommon(target);
            this._typographyProperties = TextProperties.GetTypographyProperties(target);
            if (!inlineObjects)
            {
                this._baselineAlignment = DynamicPropertyReader.GetBaselineAlignment(target);
                if (!position.IsNull)
                {
                    TextDecorationCollection highlightTextDecorations = TextProperties.GetHighlightTextDecorations(position);
                    if (highlightTextDecorations != null)
                    {
                        this._textDecorations = highlightTextDecorations;
                    }
                }
                if (getBackground)
                {
                    this._backgroundBrush = DynamicPropertyReader.GetBackgroundBrush(target);
                    return;
                }
            }
            else
            {
                this._baselineAlignment = DynamicPropertyReader.GetBaselineAlignmentForInlineObject(target);
                this._textDecorations   = DynamicPropertyReader.GetTextDecorationsForInlineObject(target, this._textDecorations);
                if (getBackground)
                {
                    this._backgroundBrush = DynamicPropertyReader.GetBackgroundBrushForInlineObject(position);
                }
            }
        }