@Override
	public int getCharPosition(int x) {
		int remainingWidth = x;
		int totalCharacters = 0;
		for (AttributedString attributedString : attributedStrings) {
			int nextWidth = attributedString.getStringWidth();
			if (nextWidth >= remainingWidth) {
				totalCharacters += attributedString.getCharPosition(remainingWidth);
				break;
			}
			remainingWidth -= nextWidth;
			totalCharacters += attributedString.length();
		}

		return totalCharacters;
	}
An AttributedString that is composed of other AttributedStrings.
Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/field/CompositeAttributedString.java