Package mdlaf.utils

Class MaterialFontFactory


  • public class MaterialFontFactory
    extends java.lang.Object
    This 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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      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
      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.
      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
      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 MaterialTypeFont
      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.
      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.
      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.
      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.
      static MaterialFontFactory getInstance()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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 MaterialTypeFont

        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

      • 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