8239149: Cleanups in SunFontManager.java and TrueTypeFont.java
Reviewed-by: prr
This commit is contained in:
parent
65bf61852f
commit
78d35f1435
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2020, 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
|
||||
@ -39,7 +39,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@ -163,11 +162,11 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
private int maxCompFont = 0;
|
||||
private CompositeFont [] compFonts = new CompositeFont[20];
|
||||
private ConcurrentHashMap<String, CompositeFont>
|
||||
compositeFonts = new ConcurrentHashMap<String, CompositeFont>();
|
||||
compositeFonts = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<String, PhysicalFont>
|
||||
physicalFonts = new ConcurrentHashMap<String, PhysicalFont>();
|
||||
physicalFonts = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<String, PhysicalFont>
|
||||
registeredFonts = new ConcurrentHashMap<String, PhysicalFont>();
|
||||
registeredFonts = new ConcurrentHashMap<>();
|
||||
|
||||
/* given a full name find the Font. Remind: there's duplication
|
||||
* here in that this contains the content of compositeFonts +
|
||||
@ -175,7 +174,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
*/
|
||||
// MACOSX begin -- need to access this in subclass
|
||||
protected ConcurrentHashMap<String, Font2D>
|
||||
fullNameToFont = new ConcurrentHashMap<String, Font2D>();
|
||||
fullNameToFont = new ConcurrentHashMap<>();
|
||||
// MACOSX end
|
||||
|
||||
/* TrueType fonts have localised names. Support searching all
|
||||
@ -266,11 +265,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
private static int maxSoftRefCnt = 10;
|
||||
|
||||
static {
|
||||
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
|
||||
public Object run() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
FontManagerNativeLibrary.load();
|
||||
|
||||
// JNI throws an exception if a class/method/field is not found,
|
||||
@ -283,15 +279,11 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
default: throw new RuntimeException("Unexpected address size");
|
||||
}
|
||||
|
||||
noType1Font =
|
||||
"true".equals(System.getProperty("sun.java2d.noType1Font"));
|
||||
jreLibDirName =
|
||||
System.getProperty("java.home","") + File.separator + "lib";
|
||||
noType1Font = "true".equals(System.getProperty("sun.java2d.noType1Font"));
|
||||
jreLibDirName = System.getProperty("java.home","") + File.separator + "lib";
|
||||
jreFontDirName = jreLibDirName + File.separator + "fonts";
|
||||
|
||||
maxSoftRefCnt =
|
||||
Integer.getInteger("sun.java2d.font.maxSoftRefs", 10);
|
||||
|
||||
maxSoftRefCnt = Integer.getInteger("sun.java2d.font.maxSoftRefs", 10);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@ -313,41 +305,27 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
/* Initialise ptrs used by JNI methods */
|
||||
private static native void initIDs();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected SunFontManager() {
|
||||
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
File badFontFile =
|
||||
new File(jreFontDirName + File.separator +
|
||||
"badfonts.txt");
|
||||
new File(jreFontDirName + File.separator + "badfonts.txt");
|
||||
if (badFontFile.exists()) {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
badFonts = new ArrayList<>();
|
||||
fis = new FileInputStream(badFontFile);
|
||||
InputStreamReader isr = new InputStreamReader(fis);
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
try (FileInputStream fis = new FileInputStream(badFontFile);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(fis))) {
|
||||
while (true) {
|
||||
String name = br.readLine();
|
||||
if (name == null) {
|
||||
break;
|
||||
} else {
|
||||
if (FontUtilities.debugFonts()) {
|
||||
FontUtilities.getLogger().warning("read bad font: " +
|
||||
name);
|
||||
FontUtilities.getLogger().warning("read bad font: " + name);
|
||||
}
|
||||
badFonts.add(name);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
if (fis != null) {
|
||||
fis.close();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,8 +385,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
*/
|
||||
boolean prependToPath = false;
|
||||
boolean appendToPath = false;
|
||||
String dbgFontPath =
|
||||
System.getProperty("sun.java2d.fontpath");
|
||||
String dbgFontPath = System.getProperty("sun.java2d.fontpath");
|
||||
|
||||
if (dbgFontPath != null) {
|
||||
if (dbgFontPath.startsWith("prepend:")) {
|
||||
@ -436,15 +413,12 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
fontPath = getPlatformFontPath(noType1Font);
|
||||
|
||||
if (extraFontPath != null) {
|
||||
fontPath =
|
||||
extraFontPath + File.pathSeparator + fontPath;
|
||||
fontPath = extraFontPath + File.pathSeparator + fontPath;
|
||||
}
|
||||
if (appendToPath) {
|
||||
fontPath =
|
||||
fontPath + File.pathSeparator + dbgFontPath;
|
||||
fontPath += File.pathSeparator + dbgFontPath;
|
||||
} else if (prependToPath) {
|
||||
fontPath =
|
||||
dbgFontPath + File.pathSeparator + fontPath;
|
||||
fontPath = dbgFontPath + File.pathSeparator + fontPath;
|
||||
} else {
|
||||
fontPath = dbgFontPath;
|
||||
}
|
||||
@ -493,8 +467,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
boolean platformFont = AccessController.doPrivileged(
|
||||
new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
String prop =
|
||||
System.getProperty("java2d.font.usePlatformFont");
|
||||
String prop = System.getProperty("java2d.font.usePlatformFont");
|
||||
String env = System.getenv("JAVA2D_USEPLATFORMFONT");
|
||||
return "true".equals(prop) || env != null;
|
||||
}
|
||||
@ -822,10 +795,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
|
||||
private final ConcurrentHashMap<String, FontRegistrationInfo>
|
||||
deferredFontFiles =
|
||||
new ConcurrentHashMap<String, FontRegistrationInfo>();
|
||||
deferredFontFiles = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<String, Font2DHandle>
|
||||
initialisedFonts = new ConcurrentHashMap<String, Font2DHandle>();
|
||||
initialisedFonts = new ConcurrentHashMap<>();
|
||||
|
||||
/* Remind: possibly enhance initialiseDeferredFonts() to be
|
||||
* optionally given a name and a style and it could stop when it
|
||||
@ -867,11 +839,10 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
synchronized (jreFontDirName) {
|
||||
if (jreOtherFontFiles == null) {
|
||||
HashSet<String> otherFontFiles = new HashSet<String>();
|
||||
HashSet<String> otherFontFiles = new HashSet<>();
|
||||
for (String deferredFile : deferredFontFiles.keySet()) {
|
||||
File file = new File(deferredFile);
|
||||
String dir = file.getParent();
|
||||
String fname = file.getName();
|
||||
/* skip names which aren't absolute, aren't in the JRE
|
||||
* directory, or are known Lucida fonts.
|
||||
*/
|
||||
@ -1006,8 +977,6 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
|
||||
PhysicalFont physicalFont = null;
|
||||
try {
|
||||
String name;
|
||||
|
||||
switch (fontFormat) {
|
||||
|
||||
case FONTFORMAT_TRUETYPE:
|
||||
@ -1173,8 +1142,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
} else {
|
||||
filter = new TTorT1Filter();
|
||||
}
|
||||
return (String[])AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String[]>() {
|
||||
public String[] run() {
|
||||
if (pathDirs.length == 1) {
|
||||
File dir = new File(pathDirs[0]);
|
||||
String[] files = dir.list(filter);
|
||||
@ -1186,7 +1155,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
return files;
|
||||
} else {
|
||||
ArrayList<String> fileList = new ArrayList<String>();
|
||||
ArrayList<String> fileList = new ArrayList<>();
|
||||
for (int i = 0; i< pathDirs.length; i++) {
|
||||
File dir = new File(pathDirs[i]);
|
||||
String[] files = dir.list(filter);
|
||||
@ -1250,7 +1219,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
} else {
|
||||
if (unmappedFontNames == null) {
|
||||
unmappedFontNames = new ArrayList<String>();
|
||||
unmappedFontNames = new ArrayList<>();
|
||||
}
|
||||
unmappedFontNames.add(font);
|
||||
}
|
||||
@ -1258,7 +1227,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
|
||||
if (unmappedFontNames != null) {
|
||||
HashSet<String> unmappedFontFiles = new HashSet<String>();
|
||||
HashSet<String> unmappedFontFiles = new HashSet<>();
|
||||
|
||||
/* Every font key in fontToFileMap ought to correspond to a
|
||||
* font key in fontToFamilyNameMap. Entries that don't seem
|
||||
@ -1313,7 +1282,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
* To compare we also need lower case
|
||||
* versions of the names from the registry.
|
||||
*/
|
||||
ArrayList<String> registryFiles = new ArrayList<String>();
|
||||
ArrayList<String> registryFiles = new ArrayList<>();
|
||||
|
||||
for (String regFile : fontToFileMap.values()) {
|
||||
registryFiles.add(regFile.toLowerCase());
|
||||
@ -1382,7 +1351,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
* To compare we also need lower case
|
||||
* versions of the names from the registry.
|
||||
*/
|
||||
ArrayList<String> registryFiles = new ArrayList<String>();
|
||||
ArrayList<String> registryFiles = new ArrayList<>();
|
||||
for (String regFile : fontToFileMap.values()) {
|
||||
registryFiles.add(regFile.toLowerCase());
|
||||
}
|
||||
@ -1409,11 +1378,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
continue;
|
||||
}
|
||||
if (fontToFileMap2 == null) {
|
||||
fontToFileMap2 = new HashMap<String,String>(fontToFileMap);
|
||||
fontToFamilyNameMap2 =
|
||||
new HashMap<String,String>(fontToFamilyNameMap);
|
||||
familyToFontListMap2 = new
|
||||
HashMap<String,ArrayList<String>>(familyToFontListMap);
|
||||
fontToFileMap2 = new HashMap<>(fontToFileMap);
|
||||
fontToFamilyNameMap2 = new HashMap<>(fontToFamilyNameMap);
|
||||
familyToFontListMap2 = new HashMap<>(familyToFontListMap);
|
||||
}
|
||||
String fontName = f.getFontName(null);
|
||||
String family = f.getFamilyName(null);
|
||||
@ -1422,9 +1389,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
fontToFileMap2.put(fontName, pathFile);
|
||||
ArrayList<String> fonts = familyToFontListMap2.get(familyLC);
|
||||
if (fonts == null) {
|
||||
fonts = new ArrayList<String>();
|
||||
fonts = new ArrayList<>();
|
||||
} else {
|
||||
fonts = new ArrayList<String>(fonts);
|
||||
fonts = new ArrayList<>(fonts);
|
||||
}
|
||||
fonts.add(fontName);
|
||||
familyToFontListMap2.put(familyLC, fonts);
|
||||
@ -1502,7 +1469,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
* default implementation does nothing.
|
||||
*/
|
||||
public HashMap<String, FamilyDescription> populateHardcodedFileNameMap() {
|
||||
return new HashMap<String, FamilyDescription>(0);
|
||||
return new HashMap<>(0);
|
||||
}
|
||||
|
||||
Font2D findFontFromPlatformMap(String lcName, int style) {
|
||||
@ -1597,8 +1564,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
final String[] files = {
|
||||
plainFile, boldFile, italicFile, boldItalicFile } ;
|
||||
|
||||
failure = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Boolean>() {
|
||||
failure = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
for (int i=0; i<files.length; i++) {
|
||||
if (files[i] == null) {
|
||||
@ -1677,9 +1643,9 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
|
||||
pathDirs = getPlatformFontDirs(noType1Font);
|
||||
|
||||
fontToFileMap = new HashMap<String,String>(100);
|
||||
fontToFamilyNameMap = new HashMap<String,String>(100);
|
||||
familyToFontListMap = new HashMap<String,ArrayList<String>>(50);
|
||||
fontToFileMap = new HashMap<>(100);
|
||||
fontToFamilyNameMap = new HashMap<>(100);
|
||||
familyToFontListMap = new HashMap<>(50);
|
||||
populateFontFileNameMap(fontToFileMap,
|
||||
fontToFamilyNameMap,
|
||||
familyToFontListMap,
|
||||
@ -1720,7 +1686,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
checkForUnreferencedFontFiles();
|
||||
/* This odd code with TreeMap is used to preserve a historical
|
||||
* behaviour wrt the sorting order .. */
|
||||
ArrayList<String> fontNames = new ArrayList<String>();
|
||||
ArrayList<String> fontNames = new ArrayList<>();
|
||||
for (ArrayList<String> a : familyToFontListMap.values()) {
|
||||
for (String s : a) {
|
||||
fontNames.add(s);
|
||||
@ -1799,8 +1765,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
} else if (pathDirs.length==1) {
|
||||
return pathDirs[0] + File.separator + s;
|
||||
} else {
|
||||
String path = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<String>() {
|
||||
String path = AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
for (int p = 0; p < pathDirs.length; p++) {
|
||||
File f = new File(pathDirs[p] +File.separator+ s);
|
||||
@ -1930,7 +1896,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
|
||||
private ConcurrentHashMap<String, Font2D> fontNameCache =
|
||||
new ConcurrentHashMap<String, Font2D>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/*
|
||||
* The client supplies a name and a style.
|
||||
@ -2300,7 +2266,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
boolean isCopy, CreatedFontTracker tracker)
|
||||
throws FontFormatException {
|
||||
|
||||
List<Font2D> fList = new ArrayList<Font2D>();
|
||||
List<Font2D> fList = new ArrayList<>();
|
||||
int cnt = 1;
|
||||
String fontFilePath = fontFile.getPath();
|
||||
FileFont font2D = null;
|
||||
@ -2343,9 +2309,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
} catch (FontFormatException e) {
|
||||
if (isCopy) {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
if (_tracker != null) {
|
||||
_tracker.subBytes((int)fFile.length());
|
||||
}
|
||||
@ -2368,10 +2333,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
if (fileCloser == null) {
|
||||
final Runnable fileCloserRunnable = new Runnable() {
|
||||
public void run() {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
for (int i = 0;i < CHANNELPOOLSIZE; i++) {
|
||||
if (fontFileCache[i] != null) {
|
||||
try {
|
||||
@ -2390,10 +2353,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -2555,7 +2516,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
if (localeFullNamesToFont != null) {
|
||||
return;
|
||||
}
|
||||
localeFullNamesToFont = new HashMap<String, TrueTypeFont>();
|
||||
localeFullNamesToFont = new HashMap<>();
|
||||
Font2D[] fonts = getRegisteredFonts();
|
||||
for (int i=0; i<fonts.length; i++) {
|
||||
if (fonts[i] instanceof TrueTypeFont) {
|
||||
@ -2775,7 +2736,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
String[] installedFamilies =
|
||||
fontManager.getInstalledFontFamilyNames(l);
|
||||
Font[] installedFonts = fontManager.getAllInstalledFonts();
|
||||
HashSet<String> names = new HashSet<String>();
|
||||
HashSet<String> names = new HashSet<>();
|
||||
for (int i=0; i<installedFamilies.length; i++) {
|
||||
names.add(installedFamilies[i].toLowerCase(l));
|
||||
}
|
||||
@ -2937,7 +2898,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
String path = getPlatformFontPath(noType1Fonts);
|
||||
StringTokenizer parser =
|
||||
new StringTokenizer(path, File.pathSeparator);
|
||||
ArrayList<String> pathList = new ArrayList<String>();
|
||||
ArrayList<String> pathList = new ArrayList<>();
|
||||
try {
|
||||
while (parser.hasMoreTokens()) {
|
||||
pathList.add(parser.nextToken());
|
||||
@ -3067,9 +3028,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
}
|
||||
initialiseDeferredFonts();
|
||||
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
if (fontPath == null) {
|
||||
fontPath = getPlatformFontPath(noType1Font);
|
||||
registerFontDirs(fontPath);
|
||||
@ -3184,9 +3144,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
Thread.dumpStack();
|
||||
FontUtilities.getLogger().info("loadAllFontFiles() called");
|
||||
}
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
if (fontPath == null) {
|
||||
fontPath = getPlatformFontPath(noType1Font);
|
||||
}
|
||||
@ -3375,7 +3334,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
*/
|
||||
protected void addToMissingFontFileList(String fileName) {
|
||||
if (missingFontFiles == null) {
|
||||
missingFontFiles = new HashSet<String>();
|
||||
missingFontFiles = new HashSet<>();
|
||||
}
|
||||
missingFontFiles.add(fileName);
|
||||
}
|
||||
@ -3542,9 +3501,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
protected void addNativeFontFamilyNames(TreeMap<String, String> familyNames, Locale requestedLocale) { }
|
||||
|
||||
public void register1dot0Fonts() {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
String type1Dir = "/usr/openwin/lib/X11/fonts/Type1";
|
||||
registerFontsInDir(type1Dir, true, Font2D.TYPE1_RANK,
|
||||
false, false);
|
||||
@ -3583,10 +3541,8 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
|
||||
private static Locale systemLocale = null;
|
||||
private static Locale getSystemStartupLocale() {
|
||||
if (systemLocale == null) {
|
||||
systemLocale = (Locale)
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
systemLocale = AccessController.doPrivileged(new PrivilegedAction<Locale>() {
|
||||
public Locale run() {
|
||||
/* On windows the system locale may be different than the
|
||||
* user locale. This is an unsupported configuration, but
|
||||
* in that case we want to return a dummy locale that will
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2020, 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
|
||||
@ -42,16 +42,14 @@ import java.nio.channels.FileChannel;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import sun.java2d.Disposer;
|
||||
import sun.java2d.DisposerRecord;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* TrueTypeFont is not called SFntFont because it is not expected
|
||||
@ -748,8 +746,7 @@ public class TrueTypeFont extends FileFont {
|
||||
|
||||
if (FontUtilities.isWindows) {
|
||||
defaultCodePage =
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("file.encoding"));
|
||||
AccessController.doPrivileged(new GetPropertyAction("file.encoding"));
|
||||
} else {
|
||||
if (languages.length != codePages.length) {
|
||||
throw new InternalError("wrong code pages array length");
|
||||
@ -814,7 +811,7 @@ public class TrueTypeFont extends FileFont {
|
||||
}
|
||||
|
||||
int range1 = buffer.getInt(78); /* ulCodePageRange1 */
|
||||
int range2 = buffer.getInt(82); /* ulCodePageRange2 */
|
||||
// int range2 = buffer.getInt(82); /* ulCodePageRange2 */
|
||||
|
||||
/* This test is too stringent for Arial on Solaris (and perhaps
|
||||
* other fonts). Arial has at least one reserved bit set for an
|
||||
@ -1382,7 +1379,7 @@ public class TrueTypeFont extends FileFont {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, Short> map = new HashMap<String, Short>(200);
|
||||
Map<String, Short> map = new HashMap<>(200);
|
||||
|
||||
// the following statements are derived from the langIDMap
|
||||
// in src/windows/native/java/lang/java_props_md.c using the following
|
||||
@ -1620,7 +1617,6 @@ public class TrueTypeFont extends FileFont {
|
||||
* needed.
|
||||
*/
|
||||
protected void initAllNames(int requestedID, HashSet<String> names) {
|
||||
|
||||
byte[] name = new byte[256];
|
||||
ByteBuffer buffer = getTableBuffer(nameTag);
|
||||
|
||||
@ -1642,7 +1638,7 @@ public class TrueTypeFont extends FileFont {
|
||||
continue; // skip over this record.
|
||||
}
|
||||
short encodingID = sbuffer.get();
|
||||
short langID = sbuffer.get();
|
||||
/* short langID = */ sbuffer.get();
|
||||
short nameID = sbuffer.get();
|
||||
int nameLen = ((int) sbuffer.get()) & 0xffff;
|
||||
int namePtr = (((int) sbuffer.get()) & 0xffff) + stringPtr;
|
||||
|
Loading…
Reference in New Issue
Block a user