Example #1
0
        /// <summary>
        ///   Returns extent of widest line of wrapped text.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="wrapWidth"></param>
        /// <returns></returns>
        public float GetWrappedTextExtent(string text, float wrapWidth, bool nonSpaceWrap)
        {
            List <TextRange> lines =
                TextWrapHelper.GetWrappedLines(this, text, wrapWidth, nonSpaceWrap);

            return(GetMaximumTextExtent(text, lines));
        }
Example #2
0
        public List <TextRange> GetLines(string text, float wrapWidth, HorizontalTextFormat format, bool nonSpaceWrap)
        {
            switch (format)
            {
            case HorizontalTextFormat.Left:
            case HorizontalTextFormat.Right:
            case HorizontalTextFormat.Centered:
                return(TextWrapHelper.GetLines(text));

            case HorizontalTextFormat.WordWrapLeft:
            case HorizontalTextFormat.WordWrapRight:
            case HorizontalTextFormat.WordWrapCentered:
                return(TextWrapHelper.GetWrappedLines(this, text, wrapWidth, nonSpaceWrap));

            default:
                throw new NotImplementedException(string.Format("Unknown text format option '{0}'", format));
            }
        }