Browse Source

Ensure returned font isn't of type UIResource.

pull/214/head
weisj 4 years ago
parent
commit
799f0557ea
  1. 9
      utils/src/main/java/com/github/weisj/darklaf/util/FontUtil.java

9
utils/src/main/java/com/github/weisj/darklaf/util/FontUtil.java

@ -33,6 +33,13 @@ public class FontUtil {
public static Font createFont(final String family, final int style, final int size) { public static Font createFont(final String family, final int style, final int size) {
// This method calls FontUtilities.getCompositeFontUIResource(Font) internally which // This method calls FontUtilities.getCompositeFontUIResource(Font) internally which
// creates a composite font with fallback support. // creates a composite font with fallback support.
return StyleContext.getDefaultStyleContext().getFont(family, style, size); return new NonUIResourceFont(StyleContext.getDefaultStyleContext().getFont(family, style, size));
}
public static class NonUIResourceFont extends Font {
public NonUIResourceFont(final Font font) {
super(font);
}
} }
} }

Loading…
Cancel
Save