Font (@Nullable String sampleString) { if (sampleString == null) return null; // assume a single font can display all chars Set<Font> fonts = new HashSet<>(); FontPreferences fontPreferences = myLookup.getFontPreferences(); for (int i = 0; i < sampleString.length(); i++) { fonts.add(ComplementaryFontsRegistry.getFontAbleToDisplay(sampleString.charAt(i), Font.PLAIN, fontPreferences, null).getFont()); } eachFont: for (Font font : fonts) { if (font.equals(myNormalFont)) continue; for (int i = 0; i < sampleString.length(); i++) { if (!font.canDisplay(sampleString.charAt(i))) { continue eachFont; } } return font; } return null; }