Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jvnet.substance.fonts
Class Fonts

    java.lang.Object
      org.jvnet.substance.fonts.Fonts

    public final class Fonts

extends java.lang.Object

Provides static access to popular Windows fonts. The sizes of the font constants are specified in typographic points, approximately 1/72 of an inch.

TODO: Consider changing the visibility of the package private methods to public. As an alternative we may provide a FontPolicy that can emulate the font choice on Windows XP/2000 and Windows Vista for different software resolutions (96dpi/120dpi) and desktop font size settings (Normal/Large/Extra Large).

Since:
  2.0
Version:
  $Revision: 1.5 $
Author:
  Karsten Lentzsch
See Also:
  `FontSet`, `FontSets`, `FontPolicy`, `FontPolicies`

Field Summary
`static java.awt.Font` | `SEGOE_UI_12PT` This is Segoe UI 9pt, the default font on western Vista with 96dpi.
`static java.awt.Font` | `SEGOE_UI_13PT` Ascent=14, descent=4, height=18, dbuX=8, dbuY=14, 13dluY=22.75px.
`static java.awt.Font` | `SEGOE_UI_15PT` Ascent=16, descent=5, height=21, dbuX=9, dbuY=16, 13dluY=26px.
`static java.lang.String` | `SEGOE_UI_NAME` The name of the default dialog font on western Windows Vista.
`static java.awt.Font` | `TAHOMA_11PT` This is the default font on western XP with 96dpi and normal fonts.
`static java.awt.Font` | `TAHOMA_13PT` Ascent=13, descent=3, height=16, dbuX=8, dbuY=13, 14dluY=22.75px.
`static java.awt.Font` | `TAHOMA_14PT` Ascent=14, descent=3, height=17, dbuX=8, dbuY=14, 14dluY=24.5px.
`static java.lang.String` | `TAHOMA_NAME` The name of the default dialog font on western Windows XP.
`static java.awt.Font` | `WINDOWS_VISTA_120DPI_NORMAL` The default icon font on western Windows Vista with 120dpi and the dialog font desktop setting "Normal".
`static java.awt.Font` | `WINDOWS_VISTA_96DPI_LARGE` The default icon font on western Windows Vista with 96dpi and the dialog font desktop setting "Large".
`static java.awt.Font` | `WINDOWS_VISTA_96DPI_NORMAL` The default icon font on western Windows Vista with 96dpi and the dialog font desktop setting "Normal".
`static java.awt.Font` | `WINDOWS_XP_120DPI_DEFAULT_GUI` The default GUI font on western Windows XP with 120dpi and the dialog font desktop setting "Normal".
`static java.awt.Font` | `WINDOWS_XP_120DPI_NORMAL` The default icon font on western Windows XP with 120dpi and the dialog font desktop setting "Normal".
`static java.awt.Font` | `WINDOWS_XP_96DPI_DEFAULT_GUI` The default GUI font on western Windows XP with 96dpi and the dialog font desktop setting "Normal".
`static java.awt.Font` | `WINDOWS_XP_96DPI_LARGE` The default icon font on western Windows XP with 96dpi and the dialog font desktop setting "Large".
`static java.awt.Font` | `WINDOWS_XP_96DPI_NORMAL` The default icon font on western Windows XP with 96dpi and the dialog font desktop setting "Normal".

Method Summary
`static java.lang.Boolean` | `canDisplayLocalizedText(java.awt.Font font, java.util.Locale locale)` Checks and answers whether the given font can display text that is localized for the specified locale.
`static java.awt.Font` | `getWindowsControlFont()` Looks up and returns the Windows control font.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TAHOMA_NAME

    public static final java.lang.String TAHOMA_NAME

  The name of the default dialog font on western Windows XP.

  See Also:
    Constant Field Values

### SEGOE_UI_NAME

    public static final java.lang.String SEGOE_UI_NAME

  The name of the default dialog font on western Windows Vista.

  See Also:
    Constant Field Values

### TAHOMA_11PT

    public static final java.awt.Font TAHOMA_11PT

  This is the default font on western XP with 96dpi and normal fonts. Ascent=11, descent=3, height=14, dbuX=6, dbuY=12, 14dluY=21px.

### TAHOMA_13PT

    public static final java.awt.Font TAHOMA_13PT

  Ascent=13, descent=3, height=16, dbuX=8, dbuY=13, 14dluY=22.75px.

### TAHOMA_14PT

    public static final java.awt.Font TAHOMA_14PT

  Ascent=14, descent=3, height=17, dbuX=8, dbuY=14, 14dluY=24.5px.

### SEGOE_UI_12PT

    public static final java.awt.Font SEGOE_UI_12PT

  This is Segoe UI 9pt, the default font on western Vista with 96dpi. Ascent=13, descent=4, height=17, dbuX=7, dbuY=13, 13dluY=21.125px.

### SEGOE_UI_13PT

    public static final java.awt.Font SEGOE_UI_13PT

  Ascent=14, descent=4, height=18, dbuX=8, dbuY=14, 13dluY=22.75px.

### SEGOE_UI_15PT

    public static final java.awt.Font SEGOE_UI_15PT

  Ascent=16, descent=5, height=21, dbuX=9, dbuY=16, 13dluY=26px.

### WINDOWS_XP_96DPI_NORMAL

    public static final java.awt.Font WINDOWS_XP_96DPI_NORMAL

  The default icon font on western Windows XP with 96dpi and the dialog font desktop setting "Normal".

### WINDOWS_XP_96DPI_DEFAULT_GUI

    public static final java.awt.Font WINDOWS_XP_96DPI_DEFAULT_GUI

  The default GUI font on western Windows XP with 96dpi and the dialog font desktop setting "Normal".

### WINDOWS_XP_96DPI_LARGE

    public static final java.awt.Font WINDOWS_XP_96DPI_LARGE

  The default icon font on western Windows XP with 96dpi and the dialog font desktop setting "Large".

### WINDOWS_XP_120DPI_NORMAL

    public static final java.awt.Font WINDOWS_XP_120DPI_NORMAL

  The default icon font on western Windows XP with 120dpi and the dialog font desktop setting "Normal".

### WINDOWS_XP_120DPI_DEFAULT_GUI

    public static final java.awt.Font WINDOWS_XP_120DPI_DEFAULT_GUI

  The default GUI font on western Windows XP with 120dpi and the dialog font desktop setting "Normal".

### WINDOWS_VISTA_96DPI_NORMAL

    public static final java.awt.Font WINDOWS_VISTA_96DPI_NORMAL

  The default icon font on western Windows Vista with 96dpi and the dialog font desktop setting "Normal".

### WINDOWS_VISTA_96DPI_LARGE

    public static final java.awt.Font WINDOWS_VISTA_96DPI_LARGE

  The default icon font on western Windows Vista with 96dpi and the dialog font desktop setting "Large".

### WINDOWS_VISTA_120DPI_NORMAL

    public static final java.awt.Font WINDOWS_VISTA_120DPI_NORMAL

  The default icon font on western Windows Vista with 120dpi and the dialog font desktop setting "Normal".

Method Detail

### getWindowsControlFont

    public static java.awt.Font getWindowsControlFont()

  Looks up and returns the Windows control font. Returns the Windows icon title font unless it is inappropriate for the Windows version, Java renderer, or locale.

  The icon title font scales with the resolution (96dpi, 101dpi, 120dpi, etc) and the desktop font size settings (normal, large, extra large). Older versions may return a poor font. Also, since Java 1.4 and Java 5 render the Windows Vista icon font Segoe UI poorly, we return the default GUI font in these environments.

  The last check is, if the icon font can display text in the default locale. Therefore we test if the locale's localized display name can be displayed by the icon font. For example, Tahoma can display "English", "Deutsch", but not the display name for "Chinese" in Chinese.

  Returns:
    the Windows control font
  Throws:
    `java.lang.UnsupportedOperationException` - on non-Windows platforms

### canDisplayLocalizedText

    public static java.lang.Boolean canDisplayLocalizedText(java.awt.Font font,
                                                            java.util.Locale locale)

  Checks and answers whether the given font can display text that is localized for the specified locale. Returns `null` if we can't test it.

  First checks, if the locale's display language is available in localized form, for example "Deutsch" for the German locale. If so, we check if the given font can display the localized display language.

  Otherwise we check some known combinations of fonts and locales and return the associated results. For all other combinations, `null` is returned to indicate that we don't know whether the font can display text in the given locale.

  Parameters:
    `font` - the font to be tested
    `locale` - the locale to be used
  Returns:
    `Boolean.TRUE` if the font can display the locale's text, `Boolean.FALSE` if not, `null` if we don't know
  Since:
    2.0.4

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD