private void sortDataAndAssignRows() {

		// sort the text by y position, then by x position
		textInfos.sort(pointComparator);

		// Group the text into rows based on font height and y position
		//TODO - Ideally, it would be nice if there was a good way to group text that
		//       varied in height in a nice way
		int lastPos = textInfos.get(0).point.y;
		int row = 0;
		for (TextInfo info : textInfos) {
			if (info.point.y != lastPos) {
				row++;
				lastPos = info.point.y;
			}

			info.row = row;
		}

		// sort the text by row, then by x position
		textInfos.sort(rowComparator);

	}
Format text into a string for rendering.
Ghidra/Framework/Generic/src/main/java/generic/text/TextLayoutGraphics.java