/// <summary> /// Recursively creates the rectangles of the blockBox, by bubbling from deep to outside of the boxes /// in the rectangle structure /// </summary> private static void BubbleRectangles(Box box, LineBox line) { if (box.Words.Count > 0) { float x = float.MaxValue, y = float.MaxValue, r = float.MinValue, b = float.MinValue; var words = line.WordsOf(box); if (words.Count > 0) { foreach (var word in words) { x = Math.Min(x, word.Left); // - word.SpacesBeforeWidth); r = Math.Max(r, word.Right); // + word.SpacesAfterWidth); y = Math.Min(y, word.Top); b = Math.Max(b, word.Bottom); } line.UpdateRectangle(box, x, y, r, b); } } else { foreach (var b in box.Boxes) { BubbleRectangles(b, line); } } }