Пример #1
0
        /// <summary>Creates node list object associated with the text.</summary>
        /// <returns></returns>
        public ProcessedText ProcessText(string text, float maxWidth, bool justify)
        {
            var nodeList = new TextNodeList(text);
            nodeList.MeasureNodes(fontData, Options);

            //we "crumble" words that are two long so that that can be split up
            var nodesToCrumble = new List<TextNode>();
            foreach (TextNode node in nodeList)
                if (node.Length >= maxWidth && node.Type == TextNodeType.Word)
                    nodesToCrumble.Add(node);

            foreach (var node in nodesToCrumble)
                nodeList.Crumble(node, 1);

            //need to measure crumbled words
            nodeList.MeasureNodes(fontData, Options);

            var processedText = new ProcessedText();
            processedText.textNodeList = nodeList;
            processedText.maxWidth = maxWidth;
            processedText.justify = justify;

            return processedText;
        }
Пример #2
0
 public TextNodeListEnumerator(TextNodeList targetList)
 {
     this.targetList = targetList;
 }