private Rectangle GetWordRectangle(Font font, string word) { var stringSize = _graphics.MeasureString(word, font); var rectWidth = (int)Math.Ceiling(stringSize.Width) + 3; var rectHeight = (int)Math.Ceiling(stringSize.Height) + 3; var rectangle = _algorithm.PutNextRectangle(new Size(rectWidth, rectHeight)); return(rectangle); }
private IEnumerable <Tag> FormTags(IReadOnlyList <string> words, string font) { var tags = new List <Tag>(); for (var i = 0; i < words.Count; i++) { var word = words[i]; var size = TextRenderer.MeasureText(word, new Font(font, 40 - i)); tags.Add(new Tag(word, layoutAlgorithm.PutNextRectangle(size), 40 - i)); } return(tags); }