org.xith3d.ui.hud.utils
Class HUDFont

java.lang.Object
  extended by org.xith3d.ui.hud.utils.HUDFont

public class HUDFont
extends java.lang.Object

The HUDFont abstracts fonts usable on the HUD.

TODO: The font size should be as euqually sized on each Canvas3D resolution. For this to work, the underlying AWT-Font must be selected appropriately to avoid scaling.


Nested Class Summary
static class HUDFont.FontStyle
           
 
Field Summary
static HUDFont.FontStyle BOLD
           
static HUDFont.FontStyle BOLD_ITALIC
           
static HUDFont.FontStyle ITALIC
           
static HUDFont.FontStyle PLAIN
           
 
Method Summary
 HUDFont derive(HUDFont.FontStyle style)
          Returns a derived font instance.
 HUDFont derive(HUDFont.FontStyle style, int size)
          Returns a derived font instance.
 HUDFont derive(int size)
          Returns a derived font instance.
 java.awt.Font getAWTFont(HUD hud)
          Returns the underlying Font.
static HUDFont getFont(java.lang.String name, HUDFont.FontStyle style, int size)
          Returns the corresponding HUDFont instance.
static HUDFont getFont(java.net.URL url, HUDFont.FontStyle style, int size)
          Returns the corresponding HUDFont instance.
 java.awt.FontMetrics getFontMetrics(HUD hud)
          Returns a matching FontMetrics.
 java.lang.String getName()
          Returns the font's name.
 int getSize()
          Returns the size.
 HUDFont.FontStyle getStyle()
          Returns the style.
static boolean getUseFontScaling()
          Gets whether fonts are scaled to match the selected resolution or are simply passed through (different optical size for different resolutions.
static void setUseFontScaling(boolean useFontScaling)
          Sets whether fonts are scaled to match the selected resolution or are simply passed through (different optical size for different resolutions.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PLAIN

public static final HUDFont.FontStyle PLAIN
See Also:
HUDFont.FontStyle.PLAIN

BOLD

public static final HUDFont.FontStyle BOLD
See Also:
HUDFont.FontStyle.BOLD

ITALIC

public static final HUDFont.FontStyle ITALIC
See Also:
HUDFont.FontStyle.ITALIC

BOLD_ITALIC

public static final HUDFont.FontStyle BOLD_ITALIC
See Also:
HUDFont.FontStyle.BOLD_ITALIC
Method Detail

setUseFontScaling

public static final void setUseFontScaling(boolean useFontScaling)
Sets whether fonts are scaled to match the selected resolution or are simply passed through (different optical size for different resolutions.

Parameters:
useFontScaling -

getUseFontScaling

public static final boolean getUseFontScaling()
Gets whether fonts are scaled to match the selected resolution or are simply passed through (different optical size for different resolutions.

Returns:
font-scaling?

getName

public final java.lang.String getName()
Returns the font's name.

Returns:
the font's name.

getStyle

public final HUDFont.FontStyle getStyle()
Returns the style.

Returns:
the style.

getSize

public final int getSize()
Returns the size.

Returns:
the size.

derive

public final HUDFont derive(HUDFont.FontStyle style,
                            int size)
Returns a derived font instance.

Parameters:
style -
size -
Returns:
a derived font instance.

derive

public final HUDFont derive(HUDFont.FontStyle style)
Returns a derived font instance.

Parameters:
style -
Returns:
a derived font instance.

derive

public final HUDFont derive(int size)
Returns a derived font instance.

Parameters:
size -
Returns:
a derived font instance.

getAWTFont

public final java.awt.Font getAWTFont(HUD hud)
Returns the underlying Font.

Parameters:
hud -
Returns:
the underlying Font

getFontMetrics

public final java.awt.FontMetrics getFontMetrics(HUD hud)
Returns a matching FontMetrics.

Parameters:
hud -
Returns:
a matching FontMetrics.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getFont

public static final HUDFont getFont(java.lang.String name,
                                    HUDFont.FontStyle style,
                                    int size)
Returns the corresponding HUDFont instance.

Parameters:
name -
style -
size -
Returns:
the corresponding HUDFont instance.

getFont

public static final HUDFont getFont(java.net.URL url,
                                    HUDFont.FontStyle style,
                                    int size)
                             throws java.io.IOException
Returns the corresponding HUDFont instance.

Parameters:
url -
style -
size -
Returns:
the corresponding HUDFont instance.
Throws:
java.io.IOException