protected virtual PDFTextReader CreateReader(PDFLayoutContext context, Style fullstyle)
        {
            TextFormat format             = TextFormat.Plain;
            bool       preserveWhitespace = fullstyle.GetValue(StyleKeys.TextWhitespaceKey, false);


            if (this is IPDFTextLiteral)
            {
                format = ((IPDFTextLiteral)this).ReaderFormat;
            }

            return(PDFTextReader.Create(this.BaseText, format, preserveWhitespace, context.TraceLog));
        }
        public virtual PDFTextReader CreateReader(PDFLayoutContext context, Style fullstyle)
        {
            if (string.IsNullOrEmpty(this.Text))
            {
                return(null);
            }

            TextFormat format             = this.ReaderFormat;
            bool       preserveWhitespace = fullstyle.GetValue(StyleKeys.TextWhitespaceKey, false);

            if (preserveWhitespace)
            {
                context.TraceLog.Add("PreFormatted", "Creating a reader with preserved white space");
            }

            return(PDFTextReader.Create(this.Text, format, preserveWhitespace, context.TraceLog));
        }
        //
        // layout methods
        //

        #region public void Layout(PDFLayoutContext context, Styles.PDFStyle fullstyle)

        /// <summary>
        /// Measures and lay's out the TextComponent that this engine references.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="fullstyle"></param>
        public void Layout(PDFLayoutContext context, Styles.Style fullstyle)
        {
            if (null == context)
            {
                throw new ArgumentNullException("context");
            }
            if (null == fullstyle)
            {
                throw new ArgumentNullException("fullstyle");
            }


            this._ctx       = context;
            this._fullstyle = fullstyle;


            this._posopts  = fullstyle.CreatePostionOptions();
            this._textopts = fullstyle.CreateTextOptions();

            if (this._posopts.PositionMode == PositionMode.Invisible)
            {
                if (context.ShouldLogDebug)
                {
                    context.TraceLog.Add(TraceLevel.Debug, "Layout", "Skipping the layout of the text component " + this.TextComponent.ID + " as it is invisible");
                }
                return;
            }

            this._frsrc = ((Document)this.TextComponent.Document).GetFontResource(this.TextRenderOptions.Font, true);

            this.Context.PerformanceMonitor.Begin(PerformanceMonitorType.Text_Layout);

            this._reader = this.TextComponent.CreateReader(context, fullstyle);

            if (null != this._reader)
            {
                this.ContinueLayout = true;
                this.DoLayoutText();
            }

            this.Context.PerformanceMonitor.End(PerformanceMonitorType.Text_Layout);
        }