/// <summary>
        ///
        /// </summary>
        /// <param name="pixelsPerDip"></param>
        /// <param name="tf"></param>
        /// <param name="st"></param>
        /// <param name="node"></param>
        /// <param name="compilation"></param>
        /// <param name="fontSize"></param>
        /// <param name="pDebugFn"></param>
        /// <returns></returns>
        public static CustomTextSource4 CreateAndInitTextSource(double pixelsPerDip,
                                                                Typeface tf, SyntaxTree st, SyntaxNode node, Compilation compilation, double fontSize,
                                                                RoslynCodeBase.DebugDelegate pDebugFn)

        {
            if (st == null)
            {
                st          = SyntaxFactory.ParseSyntaxTree("");
                node        = st.GetRoot();
                compilation = null;
            }

            var textDecorationCollection = new TextDecorationCollection();
            var typeface      = tf;
            var fontRendering = FontRendering.CreateInstance(fontSize,
                                                             TextAlignment.Left, textDecorationCollection,
                                                             Brushes.Black, typeface);
            var genericTextRunProperties = new GenericTextRunProperties(
                fontRendering,
                pixelsPerDip);
            var source = new CustomTextSource4(pixelsPerDip, fontRendering, genericTextRunProperties, pDebugFn)
            {
                EmSize      = fontSize,
                Compilation = compilation,
                Tree        = st,
                Node        = node
            };

            //source.PropertyChanged += x;
            source.Init();
            return(source);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="pixelsPerDip"></param>
        /// <param name="fontRendering"></param>
        /// <param name="genericTextRunProperties"></param>
        /// <param name="debugFn"></param>
        public CustomTextSource4(double pixelsPerDip, FontRendering fontRendering,
                                 GenericTextRunProperties genericTextRunProperties, RoslynCodeBase.DebugDelegate debugFn)
        {
            CurrentRendering = fontRendering;
            PixelsPerDip     = pixelsPerDip;

            BaseProps = genericTextRunProperties;
            _debugFn  = debugFn;
        }
 public GenericTextParagraphProperties(FontRendering newRendering, double pixelsPerDip)
 {
     _flowDirection            = FlowDirection.LeftToRight;
     _textAlignment            = newRendering.TextAlignment;
     _firstLineInParagraph     = false;
     _alwaysCollapsible        = false;
     _defaultTextRunProperties = new GenericTextRunProperties(
         newRendering.Typeface, pixelsPerDip, newRendering.FontSize, newRendering.FontSize,
         newRendering.TextDecorations, newRendering.TextColor, null,
         BaselineAlignment.Baseline, CultureInfo.CurrentUICulture);
     _textWrap        = TextWrapping.Wrap;
     _lineHeight      = 0;
     _indent          = 0;
     _paragraphIndent = 0;
 }