/// <summary>
        /// Gets text annotation content size based on the text and font.
        /// </summary>
        /// <returns>Annotation content position.</returns>
        override internal RectangleF GetContentPosition()
        {
            // Return pre calculated value
            if (!contentSize.IsEmpty)
            {
                return(new RectangleF(float.NaN, float.NaN, contentSize.Width, contentSize.Height));
            }

            // Create temporary bitmap based chart graphics if chart was not
            // rendered yet and the graphics was not created.
            // NOTE: Fix for issue #3978.
            Graphics graphics = null;

            System.Drawing.Image graphicsImage  = null;
            ChartGraphics        tempChartGraph = null;

            if (GetGraphics() == null && this.Common != null)
            {
                graphicsImage           = new System.Drawing.Bitmap(Common.ChartPicture.Width, Common.ChartPicture.Height);
                graphics                = Graphics.FromImage(graphicsImage);
                tempChartGraph          = new ChartGraphics(Common);
                tempChartGraph.Graphics = graphics;
                tempChartGraph.SetPictureSize(Common.ChartPicture.Width, Common.ChartPicture.Height);
                this.Common.graph = tempChartGraph;
            }

            // Calculate content size
            RectangleF result = RectangleF.Empty;

            if (GetGraphics() != null && this.Text.Trim().Length > 0)
            {
                // Measure text using current font and slightly increase it
                contentSize = GetGraphics().MeasureString(
                    "W" + this.ReplaceKeywords(this.Text.Replace("\\n", "\n")),
                    this.Font,
                    new SizeF(2000, 2000),
                    StringFormat.GenericTypographic);

                contentSize.Height *= 1.04f;

                // Convert to relative coordinates
                contentSize = GetGraphics().GetRelativeSize(contentSize);

                // Add spacing
                bool       annotationRelative = false;
                RectangleF textSpacing        = GetTextSpacing(out annotationRelative);
                float      spacingScaleX      = 1f;
                float      spacingScaleY      = 1f;
                if (annotationRelative)
                {
                    if (contentSize.Width > 25f)
                    {
                        spacingScaleX = contentSize.Width / 25f;
                        spacingScaleX = Math.Max(1f, spacingScaleX);
                    }
                    if (contentSize.Height > 25f)
                    {
                        spacingScaleY = contentSize.Height / 25f;
                        spacingScaleY = Math.Max(1f, spacingScaleY);
                    }
                }

                contentSize.Width  += (textSpacing.X + textSpacing.Width) * spacingScaleX;
                contentSize.Height += (textSpacing.Y + textSpacing.Height) * spacingScaleY;

                result = new RectangleF(float.NaN, float.NaN, contentSize.Width, contentSize.Height);
            }

            // Dispose temporary chart graphics
            if (tempChartGraph != null)
            {
                tempChartGraph.Dispose();
                graphics.Dispose();
                graphicsImage.Dispose();
                this.Common.graph = null;
            }

            return(result);
        }