QuickFont.QFont.ProcessText C# (CSharp) Method

ProcessText() public method

Creates node list object associated with the text.
public ProcessText ( string text, SizeF maxSize, QFontAlignment alignment ) : ProcessedText
text string
maxSize System.Drawing.SizeF
alignment QFontAlignment
return ProcessedText
        public ProcessedText ProcessText(string text, SizeF maxSize, QFontAlignment alignment)
        {
            //TODO: bring justify and alignment calculations in here

            maxSize.Width = TransformWidthToViewport(maxSize.Width);

            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 ((!Options.WordWrap || node.Length >= maxSize.Width) && 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.maxSize = maxSize;
            processedText.alignment = alignment;

            return processedText;
        }