Font (@NotNull Font oldFont, @NotNull Map<? extends Attribute, ?> attributes) { Font newFont = oldFont.deriveFont(attributes); return oldFont instanceof UIResource ? new FontUIResource(newFont) : newFont; }