public final class

FontManager

extends Object
java.lang.Object
   ↳ sun.font.FontManager

Summary

Constants
int CUBICPATHTYPE
int FONTFORMAT_COMPOSITE
int FONTFORMAT_NATIVE
int FONTFORMAT_NONE
int FONTFORMAT_T2K
int FONTFORMAT_TRUETYPE
int FONTFORMAT_TTC
int FONTFORMAT_TYPE1
int LOGICAL_FALLBACK
int MAX_LAYOUT_CHARCODE Referenced by code in the JDK which wants to test for the maximum char code for which layout may be required.
int MIN_LAYOUT_CHARCODE Referenced by code in the JDK which wants to test for the minimum char code for which layout may be required.
int NO_FALLBACK
int PHYSICAL_FALLBACK
int QUADPATHTYPE
Fields
public static boolean isSolaris8
public static boolean isSolaris9
public static Logger logger
public static boolean logging
public static boolean usingPerAppContextComposites
Public Constructors
FontManager()
Public Methods
static void addToPool(FileFont font)
static Font2D createFont2D(File fontFile, int fontFormat, boolean isCopy, CreatedFontTracker tracker)
synchronized static void deRegisterBadFont(Font2D font2D)
static Font2D findFont2D(String name, int style, int fallback)
static boolean fontSupportsDefaultEncoding(Font font)
This method is provided for internal and exclusive use by Swing.
static FontUIResource getCompositeFontUIResource(Font font)
This method is provided for internal and exclusive use by Swing.
static TreeMap<StringString> getCreatedFontFamilyNames()
static Font[] getCreatedFonts()
static CompositeFont getDefaultLogicalFont(int style)
static PhysicalFont getDefaultPhysicalFont()
static String[] getDefaultPlatformFont()
static boolean getFamilyNamesFromPlatform(TreeMap<StringString> familyNames, Locale requestedLocale)
static String getFileNameForFontName(String fontName)
static Font2D getFont2D(Font font)
static Object getFontConfigAAHint()
static Object getFontConfigAAHint(String fcFamily)
static FontUIResource getFontConfigFUIR(String fcFamily, int style, int size)
static String[] getFontNamesFromPlatform()
synchronized static String getFontPath(boolean noType1Fonts)
synchronized static String getFullNameByFileName(String fileName)
static short getLCIDFromLocale(Locale locale)
static Font2DHandle getNewComposite(String family, int style, Font2DHandle handle)
synchronized static FontScaler getNullScaler()
static int getNumFonts()
static PhysicalFont[] getPhysicalFonts()
static Font2D[] getRegisteredFonts()
static FontScaler getScaler(Font2D font, int indexInCollection, boolean supportsCJK, int filesize)
static boolean gotFontsFromPlatform()
synchronized static PhysicalFont initialiseDeferredFont(String fileNameKey)
synchronized static void initialiseDeferredFonts()
static boolean isComplexText(char[] chs, int start, int limit)
If there is anything in the text which triggers a case where char->glyph does not map 1:1 in straightforward left->right ordering, then this method returns true.
static String mapFcName(String name)
synchronized static void preferLocaleFonts()
synchronized static void preferProportionalFonts()
static void registerCompositeFont(String compositeName, String[] componentFileNames, String[] componentNames, int numMetricsSlots, int[] exclusionRanges, int[] exclusionMaxIndex, boolean defer)
static void registerCompositeFont(String compositeName, String[] componentFileNames, String[] componentNames, int numMetricsSlots, int[] exclusionRanges, int[] exclusionMaxIndex, boolean defer, ConcurrentHashMap<StringFont2D> altNameCache)
static void registerDeferredFont(String fileNameKey, String fullPathName, String[] nativeNames, int fontFormat, boolean useJavaRasterizer, int fontRank)
synchronized static void registerDeferredJREFonts(String jreDir)
static boolean registerFont(Font font)
static PhysicalFont registerFontFile(String fileName, String[] nativeNames, int fontFormat, boolean useJavaRasterizer, int fontRank)
static void registerFonts(String[] fileNames, String[][] nativeNames, int fontCount, int fontFormat, boolean useJavaRasterizer, int fontRank, boolean defer)
static void registerOtherFontFiles(HashSet registeredFontFiles)
static void removeFromPool(FileFont font)
synchronized static void replaceFont(PhysicalFont oldFont, PhysicalFont newFont)
static void setFont2D(Font font, Font2DHandle font2DHandle)
synchronized static void setNativeFontPath(String fontPath)
static boolean textLayoutIsCompatible(Font font)
Used by windows printing to assess if a font is likely to be layout compatible with JDK TrueType fonts should be, but if they have no GPOS table, but do have a GSUB table, then they are probably older fonts GDI handles differently.
synchronized static void useAlternateFontforJALocales()
static boolean usePlatformFontMetrics()
static boolean usingAlternateCompositeFonts()
static boolean usingAlternateFontforJALocales()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int CUBICPATHTYPE

Constant Value: 2 (0x00000002)

public static final int FONTFORMAT_COMPOSITE

Constant Value: 4 (0x00000004)

public static final int FONTFORMAT_NATIVE

Constant Value: 5 (0x00000005)

public static final int FONTFORMAT_NONE

Constant Value: -1 (0xffffffff)

public static final int FONTFORMAT_T2K

Constant Value: 2 (0x00000002)

public static final int FONTFORMAT_TRUETYPE

Constant Value: 0 (0x00000000)

public static final int FONTFORMAT_TTC

Constant Value: 3 (0x00000003)

public static final int FONTFORMAT_TYPE1

Constant Value: 1 (0x00000001)

public static final int LOGICAL_FALLBACK

Constant Value: 2 (0x00000002)

public static final int MAX_LAYOUT_CHARCODE

Referenced by code in the JDK which wants to test for the maximum char code for which layout may be required. Note this does not account for supplementary characters where the caller interprets 'layout' to mean any case where one 'char' (ie the java type char) does not map to one glyph

Constant Value: 8303 (0x0000206f)

public static final int MIN_LAYOUT_CHARCODE

Referenced by code in the JDK which wants to test for the minimum char code for which layout may be required. Note that even basic latin text can benefit from ligatures, eg "ffi" but we presently apply those only if explicitly requested with TextAttribute.LIGATURES_ON. The value here indicates the lowest char code for which failing to invoke layout would prevent acceptable rendering.

Constant Value: 768 (0x00000300)

public static final int NO_FALLBACK

Constant Value: 0 (0x00000000)

public static final int PHYSICAL_FALLBACK

Constant Value: 1 (0x00000001)

public static final int QUADPATHTYPE

Constant Value: 1 (0x00000001)

Fields

public static boolean isSolaris8

public static boolean isSolaris9

public static Logger logger

public static boolean logging

public static boolean usingPerAppContextComposites

Public Constructors

public FontManager ()

Public Methods

public static void addToPool (FileFont font)

public static Font2D createFont2D (File fontFile, int fontFormat, boolean isCopy, CreatedFontTracker tracker)

public static synchronized void deRegisterBadFont (Font2D font2D)

public static Font2D findFont2D (String name, int style, int fallback)

public static boolean fontSupportsDefaultEncoding (Font font)

This method is provided for internal and exclusive use by Swing.

Parameters
font representing a physical font.
Returns
  • true if the underlying font is a TrueType or OpenType font that claims to support the Microsoft Windows encoding corresponding to the default file.encoding property of this JRE instance. This narrow value is useful for Swing to decide if the font is useful for the the Windows Look and Feel, or, if a composite font should be used instead. The information used to make the decision is obtained from the ulCodePageRange fields in the font. A caller can use isLogicalFont(Font) in this class before calling this method and would not need to call this method if that returns true.

public static FontUIResource getCompositeFontUIResource (Font font)

This method is provided for internal and exclusive use by Swing. It may be used in conjunction with fontSupportsDefaultEncoding(Font) In the event that a desktop properties font doesn't directly support the default encoding, (ie because the host OS supports adding support for the current locale automatically for native apps), then Swing calls this method to get a font which uses the specified font for the code points it covers, but also supports this locale just as the standard composite fonts do. Note: this will over-ride any setting where an application specifies it prefers locale specific composite fonts. The logic for this, is that this method is used only where the user or application has specified that the native L&F be used, and that we should honour that request to use the same font as native apps use. The behaviour of this method is to construct a new composite Font object that uses the specified physical font as its first component, and adds all the components of "dialog" as fall back components. The method currently assumes that only the size and style attributes are set on the specified font. It doesn't copy the font transform or other attributes because they aren't set on a font created from the desktop. This will need to be fixed if use is broadened. Operations such as Font.deriveFont will work properly on the font returned by this method for deriving a different point size. Additionally it tries to support a different style by calling getNewComposite() below. That also supports replacing slot zero with a different physical font but that is expected to be "rare". Deriving with a different style is needed because its been shown that some applications try to do this for Swing FontUIResources. Also operations such as new Font(font.getFontName(..), Font.PLAIN, 14); will NOT yield the same result, as the new underlying CompositeFont cannot be "looked up" in the font registry. This returns a FontUIResource as that is the Font sub-class needed by Swing. Suggested usage is something like : FontUIResource fuir; Font desktopFont = getDesktopFont(..); // NOTE even if fontSupportsDefaultEncoding returns true because // you get Tahoma and are running in an English locale, you may // still want to just call getCompositeFontUIResource() anyway // as only then will you get fallback fonts - eg for CJK. if (FontManager.fontSupportsDefaultEncoding(desktopFont)) { fuir = new FontUIResource(..); } else { fuir = FontManager.getCompositeFontUIResource(desktopFont); } return fuir;

public static TreeMap<StringString> getCreatedFontFamilyNames ()

public static Font[] getCreatedFonts ()

public static CompositeFont getDefaultLogicalFont (int style)

public static PhysicalFont getDefaultPhysicalFont ()

public static String[] getDefaultPlatformFont ()

public static boolean getFamilyNamesFromPlatform (TreeMap<StringString> familyNames, Locale requestedLocale)

public static String getFileNameForFontName (String fontName)

public static Font2D getFont2D (Font font)

public static Object getFontConfigAAHint ()

public static Object getFontConfigAAHint (String fcFamily)

public static FontUIResource getFontConfigFUIR (String fcFamily, int style, int size)

public static String[] getFontNamesFromPlatform ()

public static synchronized String getFontPath (boolean noType1Fonts)

public static synchronized String getFullNameByFileName (String fileName)

public static short getLCIDFromLocale (Locale locale)

public static Font2DHandle getNewComposite (String family, int style, Font2DHandle handle)

public static synchronized FontScaler getNullScaler ()

public static int getNumFonts ()

public static PhysicalFont[] getPhysicalFonts ()

public static Font2D[] getRegisteredFonts ()

public static FontScaler getScaler (Font2D font, int indexInCollection, boolean supportsCJK, int filesize)

public static boolean gotFontsFromPlatform ()

public static synchronized PhysicalFont initialiseDeferredFont (String fileNameKey)

public static synchronized void initialiseDeferredFonts ()

public static boolean isComplexText (char[] chs, int start, int limit)

If there is anything in the text which triggers a case where char->glyph does not map 1:1 in straightforward left->right ordering, then this method returns true. Scripts which might require it but are not treated as such due to JDK implementations will not return true. ie a 'true' return is an indication of the treatment by the implementation. Whether supplementary characters should be considered is dependent on the needs of the caller. Since this method accepts the 'char' type then such chars are always represented by a pair. From a rendering perspective these will all (in the cases I know of) still be one unicode character -> one glyph. But if a caller is using this to discover any case where it cannot make naive assumptions about the number of chars, and how to index through them, then it may need the option to have a 'true' return in such a case.

public static String mapFcName (String name)

public static synchronized void preferLocaleFonts ()

public static synchronized void preferProportionalFonts ()

public static void registerCompositeFont (String compositeName, String[] componentFileNames, String[] componentNames, int numMetricsSlots, int[] exclusionRanges, int[] exclusionMaxIndex, boolean defer)

public static void registerCompositeFont (String compositeName, String[] componentFileNames, String[] componentNames, int numMetricsSlots, int[] exclusionRanges, int[] exclusionMaxIndex, boolean defer, ConcurrentHashMap<StringFont2D> altNameCache)

public static void registerDeferredFont (String fileNameKey, String fullPathName, String[] nativeNames, int fontFormat, boolean useJavaRasterizer, int fontRank)

public static synchronized void registerDeferredJREFonts (String jreDir)

public static boolean registerFont (Font font)

public static PhysicalFont registerFontFile (String fileName, String[] nativeNames, int fontFormat, boolean useJavaRasterizer, int fontRank)

public static void registerFonts (String[] fileNames, String[][] nativeNames, int fontCount, int fontFormat, boolean useJavaRasterizer, int fontRank, boolean defer)

public static void registerOtherFontFiles (HashSet registeredFontFiles)

public static void removeFromPool (FileFont font)

public static synchronized void replaceFont (PhysicalFont oldFont, PhysicalFont newFont)

public static void setFont2D (Font font, Font2DHandle font2DHandle)

public static synchronized void setNativeFontPath (String fontPath)

public static boolean textLayoutIsCompatible (Font font)

Used by windows printing to assess if a font is likely to be layout compatible with JDK TrueType fonts should be, but if they have no GPOS table, but do have a GSUB table, then they are probably older fonts GDI handles differently.

public static synchronized void useAlternateFontforJALocales ()

public static boolean usePlatformFontMetrics ()

public static boolean usingAlternateCompositeFonts ()

public static boolean usingAlternateFontforJALocales ()