Font (Font font) { if (font == null) return null; boolean isSizeConsidered = false; boolean isOriginalFontUIResource = font instanceof UIResource; if (null != myFamily && !myFamily.equals(font.getFamily(ENGLISH))) { int style = null != myStyle ? myStyle : font.getStyle(); font = new Font(myFamily, style, font.getSize()); } else if (null != myStyle && myStyle != font.getStyle()) { isSizeConsidered = true; font = mySize != null ? font.deriveFont(myStyle, Math.max(mySize * font.getSize2D(), myMinimumSize)) : font.deriveFont(myStyle); } if (mySize != null && !isSizeConsidered) { font = font.deriveFont(Math.max(mySize * font.getSize2D(), myMinimumSize)); } if (font != null && isOriginalFontUIResource && !(font instanceof UIResource)) { font = new FontUIResource(font); } return font; }