com.swfm.mica.core
Class MiFontManager
java.lang.Object
com.swfm.mica.core.MiFontManager
- public class MiFontManager
- extends java.lang.Object
This class manages Fonts by caching MiFonts for reuse and providing
the #resizeFont method that allows the draw routines (MiRenderer) to
find the correct font to draw when the graphics are zoomed in or out.
- Version:
- %I% %G%
- Author:
- Michael L. Davis
|
Method Summary |
static MiFont |
findFont(java.lang.String fullName)
|
static MiFont |
findFont(java.lang.String name,
int style,
int size)
Returns a font from the internal cache, if found, or
creates one and enters it into the internal cache, if
not found. |
static java.lang.String[] |
getFontList()
Returns a list of all font family names that this
system supports. |
static java.awt.FontMetrics |
getFontMetrics(MiFont font)
|
static MiFont |
resizeFont(MiFont font,
int maxWidth,
int maxHeight)
Returns a font that is the same as the given font but
whose width and height is as close as possible to the
given width and height but no larger. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MAX_FONT_POINT_SIZE
public static int MAX_FONT_POINT_SIZE
MiFontManager
public MiFontManager()
resizeFont
public static MiFont resizeFont(MiFont font,
int maxWidth,
int maxHeight)
- Returns a font that is the same as the given font but
whose width and height is as close as possible to the
given width and height but no larger. Large heights are
truncated to MAX_FONT_POINT_SIZE to prevent large
magnifications from consuming all of memory.
- Parameters:
font - the source fontmaxWidth - the maximum character widthmaxHeight - the maximum character height
- Returns:
- the resized font
findFont
public static MiFont findFont(java.lang.String fullName)
findFont
public static MiFont findFont(java.lang.String name,
int style,
int size)
- Returns a font from the internal cache, if found, or
creates one and enters it into the internal cache, if
not found.
- Parameters:
name - the font family namestyle - the font stylesize - the font point size
- Returns:
- the font
getFontList
public static java.lang.String[] getFontList()
- Returns a list of all font family names that this
system supports.
- Returns:
- the array of font family names
getFontMetrics
public static java.awt.FontMetrics getFontMetrics(MiFont font)