Package com.jgoodies.looks
Class Fonts
- java.lang.Object
-
- com.jgoodies.looks.Fonts
-
public final class Fonts extends java.lang.ObjectProvides 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.22 $
- See Also:
FontSet,FontSets,FontPolicy,FontPolicies
-
-
Field Summary
Fields Modifier and Type Field Description static java.awt.FontSEGOE_UI_12PTThis is Segoe UI 9pt, the default font on western Vista with 96dpi.static java.awt.FontSEGOE_UI_13PTAscent=14, descent=4, height=18, dbuX=8, dbuY=14, 13dluY=22.75px.static java.awt.FontSEGOE_UI_15PTAscent=16, descent=5, height=21, dbuX=9, dbuY=16, 13dluY=26px.static java.lang.StringSEGOE_UI_NAMEThe name of the default dialog font on western Windows Vista.static java.awt.FontTAHOMA_11PTThis is the default font on western XP with 96dpi and normal fonts.static java.awt.FontTAHOMA_13PTAscent=13, descent=3, height=16, dbuX=8, dbuY=13, 14dluY=22.75px.static java.awt.FontTAHOMA_14PTAscent=14, descent=3, height=17, dbuX=8, dbuY=14, 14dluY=24.5px.static java.lang.StringTAHOMA_NAMEThe name of the default dialog font on western Windows XP.(package private) static java.lang.StringWINDOWS_DEFAULT_GUI_FONT_KEYThe desktop property key used to lookup the DEFAULTGUI font.(package private) static java.lang.StringWINDOWS_ICON_FONT_KEYThe desktop property key used to lookup Windows' icon font.static java.awt.FontWINDOWS_VISTA_120DPI_NORMALThe default icon font on western Windows Vista with 120dpi and the dialog font desktop setting "Normal".static java.awt.FontWINDOWS_VISTA_96DPI_LARGEThe default icon font on western Windows Vista with 96dpi and the dialog font desktop setting "Large".static java.awt.FontWINDOWS_VISTA_96DPI_NORMALThe default icon font on western Windows Vista with 96dpi and the dialog font desktop setting "Normal".static java.awt.FontWINDOWS_XP_120DPI_DEFAULT_GUIThe default GUI font on western Windows XP with 120dpi and the dialog font desktop setting "Normal".static java.awt.FontWINDOWS_XP_120DPI_NORMALThe default icon font on western Windows XP with 120dpi and the dialog font desktop setting "Normal".static java.awt.FontWINDOWS_XP_96DPI_DEFAULT_GUIThe default GUI font on western Windows XP with 96dpi and the dialog font desktop setting "Normal".static java.awt.FontWINDOWS_XP_96DPI_LARGEThe default icon font on western Windows XP with 96dpi and the dialog font desktop setting "Large".static java.awt.FontWINDOWS_XP_96DPI_NORMALThe default icon font on western Windows XP with 96dpi and the dialog font desktop setting "Normal".
-
Constructor Summary
Constructors Modifier Constructor Description privateFonts()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.awt.FontgetDefaultGUIFont()Looks up and returns the Windows defaultGUI font.(package private) static java.awt.FontgetDefaultGUIFontWesternModernWindowsNormal()(package private) static java.awt.FontgetDefaultIconFontWesternModernWindowsNormal()(package private) static java.awt.FontgetDefaultIconFontWesternWindowsVistaNormal()private static java.awt.FontgetDesktopFont(java.lang.String fontName)Looks up and returns a font using the default toolkit's desktop properties.private static java.awt.FontgetFallbackFont()private static java.awt.FontgetIconFont()(package private) static java.awt.FontgetLooks1xWindowsControlFont()Returns the Windows control font used by the JGoodies Looks version 1.x.static java.awt.FontgetWindowsControlFont()Looks up and returns the Windows control font.
-
-
-
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".
-
WINDOWS_DEFAULT_GUI_FONT_KEY
static final java.lang.String WINDOWS_DEFAULT_GUI_FONT_KEY
The desktop property key used to lookup the DEFAULTGUI font. This font scales with the software resolution only but works in western and non-western Windows environments.- See Also:
getWindowsControlFont(), Constant Field Values
-
WINDOWS_ICON_FONT_KEY
static final java.lang.String WINDOWS_ICON_FONT_KEY
The desktop property key used to lookup Windows' icon font. This font scales with the software resolution and the desktop font size setting (Normal/Large/Extra Large). However, in some non-western Windows environments this font cannot display the locale's glyphs. Therefore a fallback is needed for these locales. Such a fallback can be achieved with composite fonts. See the Windows default font policy for more an implementation that aims to obtain composite fonts.- See Also:
getWindowsControlFont(), Constant Field Values
-
-
Method Detail
-
getDefaultGUIFontWesternModernWindowsNormal
static java.awt.Font getDefaultGUIFontWesternModernWindowsNormal()
-
getDefaultIconFontWesternModernWindowsNormal
static java.awt.Font getDefaultIconFontWesternModernWindowsNormal()
-
getDefaultIconFontWesternWindowsVistaNormal
static java.awt.Font getDefaultIconFontWesternWindowsVistaNormal()
-
getLooks1xWindowsControlFont
static java.awt.Font getLooks1xWindowsControlFont()
Returns the Windows control font used by the JGoodies Looks version 1.x. It is intended for visual backward compatibility only. The font returned is the default GUI font that scales with the resolution (96dpi, 120dpi, etc) but not with the desktop font size settings (normal, large, extra large).On Windows Vista, the font may be completely wrong.
- Returns:
- the Windows default GUI font that scales with the resolution, but not the desktop font size setting
- Throws:
java.lang.UnsupportedOperationException- on non-Windows platforms
-
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.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.
- Returns:
- the Windows control font
- Throws:
java.lang.UnsupportedOperationException- on non-Windows platforms
-
getDefaultGUIFont
private static java.awt.Font getDefaultGUIFont()
Looks up and returns the Windows defaultGUI font. Works around a bug with Java 1.4.2_17, 1.5.0_15, and 1.6.0 on Vista, where the win.defaultGUI.font desktop property returnsnull. In this case a logical "Dialog" font is used as fallback.- Returns:
- the Windows defaultGUI font, or a dialog font as fallback.
-
getIconFont
private static java.awt.Font getIconFont()
-
getFallbackFont
private static java.awt.Font getFallbackFont()
-
getDesktopFont
private static java.awt.Font getDesktopFont(java.lang.String fontName)
Looks up and returns a font using the default toolkit's desktop properties.- Parameters:
fontName- the name of the font to return- Returns:
- the font
-
-