Skip to content

Commit e15e30f

Browse files
committedAug 3, 2020
8249215: JFrame::setVisible crashed with -Dfile.encoding=UTF-8 on Japanese Windows
Reviewed-by: prr, serb
1 parent 13a3357 commit e15e30f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎src/java.desktop/windows/classes/sun/awt/windows/WFontConfiguration.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -152,14 +152,18 @@ protected String getFileNameFromComponentFontName(String componentFontName) {
152152

153153
/**
154154
* Returns the component font name (face name plus charset) of the
155-
* font that should be used for AWT text components. May return null.
155+
* font that should be used for AWT text components.
156156
*/
157157
public String getTextComponentFontName(String familyName, int style) {
158158
FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
159159
String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
160-
if (fontName == null) {
160+
if ((fontName == null) && !textInputCharset.equals("DEFAULT_CHARSET")) {
161161
fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
162162
}
163+
if (fontName == null) {
164+
fontName = (fontDescriptors.length > 0) ? fontDescriptors[0].getNativeName()
165+
: "Arial,ANSI_CHARSET";
166+
}
163167
return fontName;
164168
}
165169

0 commit comments

Comments
 (0)
Please sign in to comment.