src/share/classes/sun/font/SunFontManager.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -681,12 +681,11 @@
* Swing) has cached a java.awt.Font. Note that if Swing is using
* a custom composite APIs which update the standard composites have
* no effect - this is typically the case only when using the Windows
* L&F where these APIs would conflict with that L&F anyway.
*/
- Font2D oldFont = (Font2D)
- altNameCache.get(compositeName.toLowerCase(Locale.ENGLISH));
+ Font2D oldFont =altNameCache.get(compositeName.toLowerCase(Locale.ENGLISH));
if (oldFont instanceof CompositeFont) {
oldFont.handle.font2D = cf;
}
altNameCache.put(compositeName.toLowerCase(Locale.ENGLISH), cf);
}
@@ -1990,11 +1989,11 @@
}
}
if (family == null || familyName == null) {
return null;
}
- String [] fontList = (String[])family.toArray(STR_ARRAY);
+ String [] fontList = family.toArray(STR_ARRAY);
if (fontList.length == 0) {
return null;
}
/* first check that for every font in this family we can find
@@ -2083,11 +2082,11 @@
if (_usingPerAppContextComposites) {
ConcurrentHashMap<String, Font2D> altNameCache =
(ConcurrentHashMap<String, Font2D>)
AppContext.getAppContext().get(CompositeFont.class);
if (altNameCache != null) {
- font = (Font2D)altNameCache.get(mapName);
+ font = altNameCache.get(mapName);
} else {
font = null;
}
} else {
font = fontNameCache.get(mapName);
@@ -2626,12 +2625,11 @@
oldFont.handle.font2D = newFont;
physicalFonts.remove(oldFont.fullName);
fullNameToFont.remove(oldFont.fullName.toLowerCase(Locale.ENGLISH));
FontFamily.remove(oldFont);
if (localeFullNamesToFont != null) {
- Map.Entry[] mapEntries =
- (Map.Entry[])localeFullNamesToFont.entrySet().
+ Map.Entry[] mapEntries = localeFullNamesToFont.entrySet().
toArray(new Map.Entry[0]);
/* Should I be replacing these, or just I just remove
* the names from the map?
*/
for (int i=0; i<mapEntries.length;i++) {
@@ -3098,11 +3096,11 @@
/* Remove from the name cache all references to the Font2D */
private void removeFromCache(Font2D font) {
if (font == null) {
return;
}
- String[] keys = (String[])(fontNameCache.keySet().toArray(STR_ARRAY));
+ String[] keys = fontNameCache.keySet().toArray(STR_ARRAY);
for (int k=0; k<keys.length;k++) {
if (fontNameCache.get(keys[k]) == font) {
fontNameCache.remove(keys[k]);
}
}
@@ -3783,11 +3781,11 @@
addNativeFontFamilyNames(familyNames, requestedLocale);
String[] retval = new String[familyNames.size()];
Object [] keyNames = familyNames.keySet().toArray();
for (int i=0; i < keyNames.length; i++) {
- retval[i] = (String)familyNames.get(keyNames[i]);
+ retval[i] = familyNames.get(keyNames[i]);
}
if (requestedLocale.equals(Locale.getDefault())) {
lastDefaultLocale = requestedLocale;
allFamilies = new String[retval.length];
System.arraycopy(retval, 0, allFamilies, 0, allFamilies.length);