public int AddTextWordWrapWithShadow(Component_Font font, double fontSize, string text, Rectangle rectangle, EHorizontalAlignment horizontalAlign, EVerticalAlignment verticalAlign, ColorValue color)
        {
            var renderer = ViewportControl.Viewport.CanvasRenderer;

            if (font == null || font.Disposed)
            {
                font = renderer.DefaultFont;
            }
            if (font == null || font.Disposed)
            {
                return(0);
            }
            //if( font == null )
            //	font = EditorFont;
            if (fontSize < 0)
            {
                fontSize = renderer.DefaultFontSize;
            }

            var items = font.GetWordWrapLines(fontSize, renderer, text, rectangle.Size.X);

            string[] lines = new string[items.Length];
            for (int n = 0; n < lines.Length; n++)
            {
                lines[n] = items[n].Text;
            }

            AddTextLinesWithShadow(font, fontSize, lines, rectangle, horizontalAlign, verticalAlign, color);

            return(lines.Length);
        }
Example #2
0
        public static void Print(string text, ColorValue color)
        {
            if (text == null)
            {
                text = "null";
            }

            while (strings.Count > 256)
            {
                strings.RemoveAt(0);
            }

            CanvasRenderer renderer = MainViewport.CanvasRenderer;

            if (font != null && renderer != null)
            {
                var items = font.GetWordWrapLines(fontSize, renderer, text, .98f);
                foreach (var item in items)
                {
                    if (stringDownPosition == strings.Count - 1)
                    {
                        stringDownPosition++;
                    }
                    strings.Add(new OldString(item.Text, color));
                }
            }
            else
            {
                if (stringDownPosition == strings.Count - 1)
                {
                    stringDownPosition++;
                }
                strings.Add(new OldString(text, color));
            }
        }