Font (Font font) { boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac"); Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize()); return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback); }