Package mdlaf.utils
Class MaterialFontFactory
- java.lang.Object
-
- mdlaf.utils.MaterialFontFactory
-
public class MaterialFontFactory extends java.lang.ObjectThis class managed the font inside the library and inside the Look and Feel, in fact this class uses a flyweight pattern to minimized the font instance created from the library. In fact on a lot of components you have only 4 instance of font in a normal use case.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classMaterialFontFactory.MaterialTypeFontEnum class that.
-
Field Summary
Fields Modifier and Type Field Description static MaterialFontFactory.MaterialTypeFontBOLDprotected java.util.Map<java.lang.String,javax.swing.plaf.FontUIResource>cacheFontprotected floatdefaultSizestatic MaterialFontFactory.MaterialTypeFontITALICstatic MaterialFontFactory.MaterialTypeFontMEDIUMprotected java.util.PropertiespropertiesThe path font was load from a proprieties file.static MaterialFontFactory.MaterialTypeFontREGULARprotected booleanwithPersonalSettings
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description floatdoOptimizingDimensionFont(float dimension)In this method optimizing the font dimension with the display resolution This method to calculate the font dimension is bad, We now but the JDK 8 display the font very bad and at the moment with the JDK 8 the dimension of the font is calculate with the screen resolution and with the JDK9+ the font set with the defaultSize @see defaultSizestatic java.awt.FontfontUtilsDisplayable(java.lang.String textDisplayable, java.awt.Font withFont)Deprecated.this method will be removed in the version 1.2, this method is not really util fot the library.javax.swing.plaf.FontUIResourcegetFont(MaterialFontFactory.MaterialTypeFont typeFont)This method load the library default font, at this moment this is a Noto Sans font, you can load 4 different dimension of font, @see MaterialTypeFontjavax.swing.plaf.FontUIResourcegetFont(MaterialFontFactory.MaterialTypeFont typeFont, boolean withPersonalSettings)This method load the library default font, at this moment this is a Noto Sans font, you can load 4 different dimension of font, @see MaterialTypeFontjavax.swing.plaf.FontUIResourcegetFontWithPath(java.lang.String path)This method load the font from a String path, in common this method should be use to load the personal font in a personal location.javax.swing.plaf.FontUIResourcegetFontWithPath(java.lang.String path, boolean withPersonalSettings)This method load the font from a String path, in common this method should be use to load the personal font in a personal location.javax.swing.plaf.FontUIResourcegetFontWithStream(java.io.InputStream stream)This method load the font from a input resource, in common this method should be use to load the personal font in a personal resource.javax.swing.plaf.FontUIResourcegetFontWithStream(java.io.InputStream stream, boolean withPersonalSettings)This method load the font from a input resource, in common this method should be use to load the personal font in a personal resource.static MaterialFontFactorygetInstance()
-
-
-
Field Detail
-
REGULAR
public static final MaterialFontFactory.MaterialTypeFont REGULAR
-
BOLD
public static final MaterialFontFactory.MaterialTypeFont BOLD
-
ITALIC
public static final MaterialFontFactory.MaterialTypeFont ITALIC
-
MEDIUM
public static final MaterialFontFactory.MaterialTypeFont MEDIUM
-
properties
protected java.util.Properties properties
The path font was load from a proprieties file. This can permit the user to change the font also with a proprieties file see The file inside resources/config/fonts.properties
-
cacheFont
protected java.util.Map<java.lang.String,javax.swing.plaf.FontUIResource> cacheFont
-
defaultSize
protected float defaultSize
-
withPersonalSettings
protected boolean withPersonalSettings
-
-
Method Detail
-
getInstance
public static MaterialFontFactory getInstance()
-
fontUtilsDisplayable
@Deprecated public static java.awt.Font fontUtilsDisplayable(java.lang.String textDisplayable, java.awt.Font withFont)Deprecated.this method will be removed in the version 1.2, this method is not really util fot the library.
-
getFontWithPath
public javax.swing.plaf.FontUIResource getFontWithPath(java.lang.String path)
This method load the font from a String path, in common this method should be use to load the personal font in a personal location.
-
getFontWithStream
public javax.swing.plaf.FontUIResource getFontWithStream(java.io.InputStream stream)
This method load the font from a input resource, in common this method should be use to load the personal font in a personal resource.
-
getFont
public javax.swing.plaf.FontUIResource getFont(MaterialFontFactory.MaterialTypeFont typeFont)
This method load the library default font, at this moment this is a Noto Sans font, you can load 4 different dimension of font, @see MaterialTypeFont
-
getFont
public javax.swing.plaf.FontUIResource getFont(MaterialFontFactory.MaterialTypeFont typeFont, boolean withPersonalSettings)
This method load the library default font, at this moment this is a Noto Sans font, you can load 4 different dimension of font, @see MaterialTypeFontIn addition, this method have the boolean (by default this propriety is true) called withPersonalSettings to jump the personal font setting. This is util when you have other library that work with font and you want take the control on your code
-
getFontWithPath
public javax.swing.plaf.FontUIResource getFontWithPath(java.lang.String path, boolean withPersonalSettings)This method load the font from a String path, in common this method should be use to load the personal font in a personal location.In addition, this method have the boolean (by default this propriety is true) called withPersonalSettings to jump the personal font setting. This is util when you have other library that work with font and you want take the control on your code
-
getFontWithStream
public javax.swing.plaf.FontUIResource getFontWithStream(java.io.InputStream stream, boolean withPersonalSettings)This method load the font from a input resource, in common this method should be use to load the personal font in a personal resource. In addition, this method have the boolean (by default this propriety is true) called withPersonalSettings to jump the personal font setting. This is util when you have other library that work with font and you want take the control on your code
-
doOptimizingDimensionFont
public float doOptimizingDimensionFont(float dimension)
In this method optimizing the font dimension with the display resolution This method to calculate the font dimension is bad, We now but the JDK 8 display the font very bad and at the moment with the JDK 8 the dimension of the font is calculate with the screen resolution and with the JDK9+ the font set with the defaultSize @see defaultSize- Parameters:
dimension- is the dimension font that you want optimizing
-
-