-
Bug
-
Resolution: Not an Issue
-
P2
-
None
-
1.1.7
-
generic
-
generic, solaris_2.6
Name: diC59631 Date: 12/14/98
Up until 1.1.7 running java without a
font.properties file has worked just fine. java
would use the system fonts. Now with 1.1.7 and 1.2
if font.properties isn't found then java displays garbage fonts.
Text is completely unreadables.
Between 1.1.6 and 1.1.7 the section of code in
PlatformFont.java that looks for the font.properties
file was completely rewritten. Before 1.1.7 if
font.properties was not found fprops would end up
being null but in 1.1.7 and 1.2 fprops is set to
some defaults with "unknown" as the font family.
The rest of AWT doesn't seem to know how to deal
with this and displays garbage.
Applying the following changes to PlatformFont.java
fixes the problem.
f = tryOpeningFontProp(f, uhome, language, encoding);
f = tryOpeningFontProp(f, jhome, language, encoding);
f = tryOpeningFontProp(f, uhome, language, null);
f = tryOpeningFontProp(f, jhome, language, null);
f = tryOpeningFontProp(f, uhome, encoding, null);
f = tryOpeningFontProp(f, jhome, encoding, null);
f = tryOpeningFontProp(f, uhome, null, null);
f = tryOpeningFontProp(f, jhome, null, null);
if (f != null) { /* CHANGES */
// set default props to prevent crashing
// with corrupted font.properties
Properties defaultProps = new Properties();
defaultProps.put("serif.0", "unknown");
defaultProps.put("sansserif.0", "unknown");
defaultProps.put("monospaced.0", "unknown");
defaultProps.put("dialog.0", "unknown");
defaultProps.put("dialoginput.0", "unknown");
fprops = new Properties(defaultProps);
// Load property file
InputStream in =
new BufferedInputStream(new FileInputStream(f.getPath()));
fprops.load(in);
in.close();
} else { /* CHANGES */
fprops = null; /* CHANGES */
} /* CHANGES */
} catch (Exception e){
fprops = null; /* CHANGES */
}
We have never shipped a font.properties file with
our jdk's in the past. Requiring a font.properties
file makes it impossible to default to the system
fonts.
(Review ID: 47925)
======================================================================
- duplicates
-
JDK-4225245 1.1.x regression: used to work without any font properties file.
- Closed