Exemplo n.º 1
0
 internal static void DrawText(this IStylePainter painter, BaseTextElement te)
 {
     if (!string.IsNullOrEmpty(te.text) && te.contentRect.width > 0.0f && te.contentRect.height > 0.0f)
     {
         painter.DrawText(painter.GetDefaultTextParameters(te));
     }
 }
        internal static CursorPositionStylePainterParameters GetDefaultCursorPositionParameters(this IStylePainter painter, BaseTextElement te)
        {
            IStyle style = te.style;

            return(new CursorPositionStylePainterParameters
            {
                rect = te.contentRect,
                text = te.text,
                font = style.font,
                fontSize = style.fontSize,
                fontStyle = style.fontStyle,
                anchor = style.textAlignment,
                wordWrapWidth = ((!style.wordWrap) ? 0f : te.contentRect.width),
                richText = false,
                cursorIndex = 0
            });
        }
        internal static TextStylePainterParameters GetDefaultTextParameters(this IStylePainter painter, BaseTextElement te)
        {
            IStyle style = te.style;

            return(new TextStylePainterParameters
            {
                rect = te.contentRect,
                text = te.text,
                font = style.font,
                fontSize = style.fontSize,
                fontStyle = style.fontStyle,
                fontColor = style.textColor.GetSpecifiedValueOrDefault(Color.black),
                anchor = style.textAlignment,
                wordWrap = style.wordWrap,
                wordWrapWidth = ((!style.wordWrap) ? 0f : te.contentRect.width),
                richText = false,
                clipping = style.textClipping
            });
        }