FontInfo (int codePoint, @JdkConstants.FontStyle int style, @NotNull FontPreferences preferences, FontRenderContext context) { boolean tryDefaultFallback = true; List<String> fontFamilies = preferences.getEffectiveFontFamilies(); boolean useLigatures = !Patches.TEXT_LAYOUT_IS_SLOW && preferences.useLigatures(); FontInfo result; for (int i = 0, len = fontFamilies.size(); i < len; ++i) { // avoid foreach, it instantiates ArrayList$Itr, this traversal happens very often final String fontFamily = fontFamilies.get(i); result = doGetFontAbleToDisplay(codePoint, preferences.getSize2D(fontFamily), style, fontFamily, i == 0 ? preferences.getRegularSubFamily() : null, i == 0 ? preferences.getBoldSubFamily() : null, useLigatures, context, true, true); if (result != null) { return result; } tryDefaultFallback &= !DEFAULT_FALLBACK_FONT.equals(fontFamily); } float size = FontPreferences.DEFAULT_FONT_SIZE; if (!fontFamilies.isEmpty()) { size = preferences.getSize2D(fontFamilies.get(0)); } if (tryDefaultFallback) { result = doGetFontAbleToDisplay(codePoint, size, style, DEFAULT_FALLBACK_FONT, null, null, useLigatures, context, false, false); if (result != null) { return result; } } result = doGetFontAbleToDisplay(codePoint, null, 0, 0, size, style, useLigatures, context); if (LOG.isTraceEnabled()) { LOG.trace("Fallback font: " + result.getFont().getFontName()); } return result; }