private void updateCurrentTextWithNewFont() {
		Document document = getDocument();

		if (document == null) {
			return;
		}

		SystemUtilities.assertTrue(document instanceof StyledDocument,
			getClass().getName() + " is designed to work with StyledDocuments");

		StyledDocument styledDocument = (StyledDocument) document;
		int length = document.getLength();
		for (int i = 0; i < length;) {
			Element element = styledDocument.getCharacterElement(i);
			int elementStart = i;
			int elementLen = element.getEndOffset() - elementStart;
			i = element.getEndOffset();

			// get the name of the old AttributeSet and use that to pick the new live
			// AttributeSet that was updated.
			AttributeSet replacementAttributeSet = getAttributeSetByName(
				(String) element.getAttributes().getAttribute(CUSTOM_ATTRIBUTE_KEY));
			styledDocument.setCharacterAttributes(elementStart, elementLen, replacementAttributeSet,
				true);
		}
	}
% of characters to delete when truncation is necessary
Ghidra/Features/Base/src/main/java/ghidra/framework/main/ConsoleTextPane.java