String (@NotNull @Nls String input, int style, @NotNull Font baseFont) { int start = baseFont.canDisplayUpTo(input); if (start == -1) return input; @Nls StringBuilder result = new StringBuilder(); FontFallbackIterator it = new FontFallbackIterator(); it.setPreferredFont(baseFont.getFamily(), baseFont.getSize()); it.setFontStyle(style); it.start(input, 0, input.length()); while (!it.atEnd()) { Font font = it.getFont(); boolean insideFallbackBlock = !font.getFamily().equals(baseFont.getFamily()); if (insideFallbackBlock) { result.append("<font face=\"").append(font.getFamily()).append("\">"); //NON-NLS } result.append(input, it.getStart(), it.getEnd()); if (insideFallbackBlock) { result.append("</font>"); //NON-NLS } it.advance(); } return result.toString(); }