org.mt4j.components.visibleComponents.font
Class FontManager

java.lang.Object
  extended by org.mt4j.components.visibleComponents.font.FontManager

public class FontManager
extends java.lang.Object

    

Manager for creating fonts. Manages a set of IFontFactory classes.

Author:
Christopher Ruff

Method Summary
 IFont createFont(processing.core.PApplet pa, java.lang.String fontFileName, int fontSize)
          Loads and returns a font from a file.
 IFont createFont(processing.core.PApplet pa, java.lang.String fontFileName, int fontSize, MTColor fillColor, MTColor strokeColor)
          Loads and returns a vector font from a file.
static boolean fontsAreEqual(IFont font, java.lang.String IVectorFontFileName, int fontSize, MTColor fillColor, MTColor strokeColor)
          Fonts are equal.
static FontManager getInstance()
          Gets the instance.
static boolean isFontsAreEqual(IFont font1, IFont font2)
          Checks if is fonts are equal.
 void registerFontFactory(java.lang.String fileSuffix, IFontFactory factory)
          Register a new fontfactory for a file type.
 void unregisterFontFactory(IFontFactory factory)
          Unregister a fontfactory for a file type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static FontManager getInstance()
Gets the instance.

Returns:
the instance this VectorFontManager, use createFont to create a font with it

createFont

public IFont createFont(processing.core.PApplet pa,
                        java.lang.String fontFileName,
                        int fontSize)
Loads and returns a font from a file.
The file has to be located in the ./data/ directory of the program.
Example: "IFont font = FontManager.createFont(papplet, "Pakenham.svg", 100);"

Parameters:
pa - the pa
fontFileName - the font file name
fontSize - the font size
Returns:
the i font

createFont

public IFont createFont(processing.core.PApplet pa,
                        java.lang.String fontFileName,
                        int fontSize,
                        MTColor fillColor,
                        MTColor strokeColor)
Loads and returns a vector font from a file.
The file has to be located in the ./data/ directory of the program.

Parameters:
pa - the pa
fontFileName - the font file name
fontSize - the font size
fillColor - the fill color
strokeColor - the stroke color
Returns:
the i font

registerFontFactory

public void registerFontFactory(java.lang.String fileSuffix,
                                IFontFactory factory)
Register a new fontfactory for a file type.

Parameters:
factory - the factory
fileSuffix - the file suffix to use with that factory. ".ttf" for example.

unregisterFontFactory

public void unregisterFontFactory(IFontFactory factory)
Unregister a fontfactory for a file type.

Parameters:
factory - the factory

fontsAreEqual

public static boolean fontsAreEqual(IFont font,
                                    java.lang.String IVectorFontFileName,
                                    int fontSize,
                                    MTColor fillColor,
                                    MTColor strokeColor)
Fonts are equal.

Parameters:
font - the font
IVectorFontFileName - the i vector font file name
fontSize - the font size
fillColor - the fill color
strokeColor - the stroke color
Returns:
true, if successful

isFontsAreEqual

public static boolean isFontsAreEqual(IFont font1,
                                      IFont font2)
Checks if is fonts are equal.

Parameters:
font1 - the font1
font2 - the font2
Returns:
true, if is fonts are equal