Font (Crumb crumb) { Font font = getFont(); if (font == null) return null; int old = font.getStyle(); if (font != cache[old]) { for (int i = 0; i < cache.length; i++) { cache[i] = i == old ? font : null; } } int style = getFontStyle(crumb); if (style == old) return font; Font cached = cache[style]; if (cached != null) return cached; font = font.deriveFont(style); cache[style] = font; return font; }