changeset 60041:e7f126fb2655

8248468: java/awt/font/DefaultFontTest/DefaultFontTest.java fails in SunFontManager.findFont2D Reviewed-by: jdv
author mbaesken
date Mon, 29 Jun 2020 09:59:45 +0200
parents 144c75948136
children 183436d75caa
files src/java.desktop/share/classes/sun/font/SunFontManager.java src/java.desktop/unix/classes/sun/awt/FcFontManager.java
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/sun/font/SunFontManager.java	Thu Jul 02 17:19:16 2020 -0700
+++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java	Mon Jun 29 09:59:45 2020 +0200
@@ -353,6 +353,9 @@
 
                 String[] fontInfo = getDefaultPlatformFont();
                 defaultFontName = fontInfo[0];
+                if (defaultFontName == null && FontUtilities.debugFonts()) {
+                    FontUtilities.getLogger().warning("defaultFontName is null");
+                }
                 defaultFontFileName = fontInfo[1];
 
                 String extraFontPath = fontConfig.getExtraFontPath();
@@ -1888,6 +1891,7 @@
      * may be able to emulate the required style.
      */
     public Font2D findFont2D(String name, int style, int fallback) {
+        if (name == null) return null;
         String lowerCaseName = name.toLowerCase(Locale.ENGLISH);
         String mapName = lowerCaseName + dotStyleStr(style);
 
--- a/src/java.desktop/unix/classes/sun/awt/FcFontManager.java	Thu Jul 02 17:19:16 2020 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/FcFontManager.java	Mon Jun 29 09:59:45 2020 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -89,7 +89,8 @@
          */
         if (info[0] == null) {
             if (fontConfigFonts != null && fontConfigFonts.length > 0 &&
-                fontConfigFonts[0].firstFont.fontFile != null) {
+                fontConfigFonts[0].firstFont.fontFile != null &&
+                fontConfigFonts[0].firstFont.fullName != null) {
                 info[0] = fontConfigFonts[0].firstFont.fullName;
                 info[1] = fontConfigFonts[0].firstFont.fontFile;
             } else {