com.taco.i18n.gui
Class FontUtilities.DefaultFontMapper

java.lang.Object
  extended by com.taco.i18n.gui.FontUtilities.DefaultFontMapper
All Implemented Interfaces:
FontUtilities.IFontMapper
Enclosing class:
FontUtilities

public static class FontUtilities.DefaultFontMapper
extends java.lang.Object
implements FontUtilities.IFontMapper

A default implementation of IFontMapper.


Field Summary
static FontUtilities.DefaultFontMapper instance
           
 
Constructor Summary
FontUtilities.DefaultFontMapper()
           
 
Method Summary
protected  java.awt.Font _adjustFont(java.util.Locale oldLocale, java.awt.Font oldFont, java.util.Locale locale, java.awt.Font font)
          Once _getFont() has decided which font to use, return an adjusted the font which can replace the original font.
protected  java.awt.Font _getFont(java.util.Locale oldLocale, java.awt.Font oldFont, java.util.Locale locale, java.awt.Font[] availableFonts)
           
 java.awt.Font fontForBorder(java.util.Locale oldLocale, javax.swing.border.Border border, java.util.Locale locale, java.awt.Font[] availableFonts)
          Return a font suitable for displaying characters in the argument locale, to be used in the argument border.
 java.awt.Font fontForComponent(java.util.Locale oldLocale, java.awt.Component component, java.util.Locale locale, java.awt.Font[] availableFonts)
          If the component doesn't have its font set, return null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static final FontUtilities.DefaultFontMapper instance
Constructor Detail

FontUtilities.DefaultFontMapper

public FontUtilities.DefaultFontMapper()
Method Detail

fontForComponent

public java.awt.Font fontForComponent(java.util.Locale oldLocale,
                                      java.awt.Component component,
                                      java.util.Locale locale,
                                      java.awt.Font[] availableFonts)
If the component doesn't have its font set, return null. Otherwise, get the component's current font. The 5 logical fonts are mapped to the first five fonts in availableFonts, modulo the size of availableFonts. Return a font with the same point size and style as the component's current font.

Specified by:
fontForComponent in interface FontUtilities.IFontMapper
Parameters:
oldLocale - The locale to change from.
component - The component the returned font is for.
locale - The locale to change to.
availableFonts - An array of fonts capable of displaying characters in the argument locale.
Returns:
The font to be used for the component, or null if the font doesn't need to be set.

fontForBorder

public java.awt.Font fontForBorder(java.util.Locale oldLocale,
                                   javax.swing.border.Border border,
                                   java.util.Locale locale,
                                   java.awt.Font[] availableFonts)
Description copied from interface: FontUtilities.IFontMapper
Return a font suitable for displaying characters in the argument locale, to be used in the argument border. If the font doesn't need to be set, return null.

Specified by:
fontForBorder in interface FontUtilities.IFontMapper
Parameters:
oldLocale - The locale to change from.
border - The border the returned font is for.
locale - The locale to change to.
availableFonts - An array of fonts capable of displaying characters in the argument locale.
Returns:
The font to be used for the border, or null if the font doesn't need to be set.

_getFont

protected java.awt.Font _getFont(java.util.Locale oldLocale,
                                 java.awt.Font oldFont,
                                 java.util.Locale locale,
                                 java.awt.Font[] availableFonts)

_adjustFont

protected java.awt.Font _adjustFont(java.util.Locale oldLocale,
                                    java.awt.Font oldFont,
                                    java.util.Locale locale,
                                    java.awt.Font font)
Once _getFont() has decided which font to use, return an adjusted the font which can replace the original font. This implementation returns a font with the same style, and a size at least as big as the original. If the new locale is East Asian (which uses kanji) and the old locale is not, make the font 3 points bigger.