|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ascape.util.vis.ERVDerivedFontMap
public class ERVDerivedFontMap
Class DerivedFontMap is used to maintain instances of derived fonts. This
minimizes calls to Font.deriveFont, which makes up a new Font each time it is
called. This is particularly useful in highly dynamic environments (such as
animation, or a place where objects and fonts are resized often). Any of the
single-argument calls to Font.deriveFont are supported for storage and
retrieval via getFont. Multi-argument calls to deriveFont are passed through
the getFont call but are NOT stored. The user can make up some arbitrary key
and store the key-Font pair in the map via the setFont()
method.
It is useful to note that the font size is roughly proportional to the pixel
size, so if one needs a font to fit into an approximately 24 pixel high
space, a good place to start experimenting is with with a Font returned by a
call to a DerivedFontMap.getFont(24f). The results will of course vary quite
a bit depending on the baseFont.
Constructor Summary | |
---|---|
ERVDerivedFontMap(java.awt.Font baseFont)
Usually the baseFont has a size of 1, e.g. |
Method Summary | |
---|---|
java.awt.Font |
getFont(java.awt.geom.AffineTransform transform)
Return a new Font object by replicating the current Font object and applying a new transform to it. |
java.awt.Font |
getFont(float fontSize)
Obtain a derived font, creating one if need be. |
java.awt.Font |
getFont(int style)
Return a new Font object by replicating the current Font object and applying a new style to it. |
java.awt.Font |
getFont(java.util.Map attributes)
Return a new Font object by replicating the current Font object and applying a new set of font attributes to it. |
java.awt.Font |
getFont(java.lang.Object key)
Obtain a font stored by key. |
void |
setFont(java.lang.Object key,
java.awt.Font font)
Store a font (this should be a font derived from the base font) under a special key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ERVDerivedFontMap(java.awt.Font baseFont)
new Font("Serif",
Font.PLAIN, 1));
baseFont
- parameterMethod Detail |
---|
public java.awt.Font getFont(float fontSize)
fontSize
- parameter
public java.awt.Font getFont(java.awt.geom.AffineTransform transform)
transform
- parameter
public java.awt.Font getFont(int style)
style
- parameter
public java.awt.Font getFont(java.util.Map attributes)
attributes
- parameter
public java.awt.Font getFont(java.lang.Object key)
Font.deriveFont()
.
key
- parameter
public void setFont(java.lang.Object key, java.awt.Font font)
key
- the fontfont
- the font
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |