/** * Looks up and retrieves the {@link FontPolicy} used by the Substance * family. If a {@link FontPolicy} has been set, it'll be returned. * Otherwise, this method checks if a {@link FontPolicy} or {@link FontSet} * is defined in the system properties or UIDefaults. If so, it is returned. * If no {@link FontPolicy} has been set for this look, in the system * properties or {@link UIDefaults}, the default Substance font policy will * be returned. * * @return the {@link FontPolicy} set for this Look&feel - if any, the * {@link FontPolicy} specified in the system properties or * {@link UIDefaults} - if any, or the default Substance font * policy. * * @see #setFontPolicy(org.pushingpixels.substance.api.fonts.FontPolicy) * @see FontPolicies * @see FontPolicies#customSettingsPolicy(FontPolicy) */ public static FontPolicy getFontPolicy() { FontPolicy policy = (FontPolicy) UIManager .get(SUBSTANCE_FONT_POLICY_KEY); if (policy != null) return policy; // return default policy return SubstanceFontUtilities.getDefaultFontPolicy(); }
/** * Looks up and retrieves the {@link FontPolicy} used by the Substance * family. If a {@link FontPolicy} has been set, it'll be returned. * Otherwise, this method checks if a {@link FontPolicy} or {@link FontSet} * is defined in the system properties or UIDefaults. If so, it is returned. * If no {@link FontPolicy} has been set for this look, in the system * properties or {@link UIDefaults}, the default Substance font policy will * be returned. * * @return the {@link FontPolicy} set for this Look&feel - if any, the * {@link FontPolicy} specified in the system properties or * {@link UIDefaults} - if any, or the default Substance font * policy. * * @see #setFontPolicy * @see FontPolicies * @see FontPolicies#customSettingsPolicy(FontPolicy) */ public static FontPolicy getFontPolicy() { FontPolicy policy = (FontPolicy) UIManager .get(SUBSTANCE_FONT_POLICY_KEY); if (policy != null) return policy; // return default policy return SubstanceFontUtilities.getDefaultFontPolicy(); }
/** * Returns scaled platform-specific font policy. * * @param scaleFactor * Scale factor. Should be positive. * @return Scaled platform-specific font policy. */ public static FontPolicy getScaledFontPolicy(final float scaleFactor) { final FontSet substanceCoreFontSet = SubstanceFontUtilities .getDefaultFontPolicy().getFontSet("Substance", null); // Create the scaled font set FontPolicy newFontPolicy = new FontPolicy() { public FontSet getFontSet(String lafName, UIDefaults table) { return new ScaledFontSet(substanceCoreFontSet, scaleFactor); } }; return newFontPolicy; } }
/** * Returns scaled platform-specific font policy. * * @param scaleFactor * Scale factor. Should be positive. * @return Scaled platform-specific font policy. */ public static FontPolicy getScaledFontPolicy(final float scaleFactor) { final FontSet substanceCoreFontSet = SubstanceFontUtilities .getDefaultFontPolicy().getFontSet("Substance", null); // Create the scaled font set FontPolicy newFontPolicy = new FontPolicy() { @Override public FontSet getFontSet(String lafName, UIDefaults table) { return new ScaledFontSet(substanceCoreFontSet, scaleFactor); } }; return newFontPolicy; } }