private int updateLimitForNewline(String text, int position, int limit) {
		int newline = text.indexOf('\n', position);
		if (newline != -1) {
			if (newline >= position && newline < limit) {
				// newline will be in the current line; break on the newline
				return newline - position;
			}
		}
		return limit;
	}
Creates a text shaper with the given text, display size and graphics context.
@param text the text
@param displaySize the size
@param g2d the graphics
Ghidra/Framework/Docking/src/main/java/docking/util/TextShaper.java