private String removeNewlinesAroundText(String s) {
		int first = 0;
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (c != '\n') {
				first = i;
				break;
			}
		}

		s = s.substring(first);

		int last = s.length() - 1;
		for (int i = last; i >= 0; i--) {
			char c = s.charAt(i);
			if (c != '\n') {
				last = i;
				break;
			}
		}
		return s.substring(0, last + 1);
	}
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